dcp-worker 3.2.30-7 → 3.2.30-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitlab-ci.yml CHANGED
@@ -28,5 +28,4 @@ tidelift:
28
28
  script:
29
29
  - echo "Running alignment and saving to Tidelift"
30
30
  - ./tidelift alignment save --wait
31
- allow_failure: true
32
31
  cache: []
package/bin/dcp-worker CHANGED
@@ -8,16 +8,21 @@
8
8
  */
9
9
  'use strict';
10
10
 
11
- var worker;
12
-
13
11
  const process = require('process');
14
12
  const fs = require('fs');
15
- const path = require('path');
16
13
  const crypto = require('crypto');
17
14
  const chalk = require('chalk');
18
- const telnetd = require('../lib/remote-console');
19
15
 
20
16
  const configName = process.env.DCP_CONFIG || '../etc/dcp-worker-config';
17
+ var worker, dcpConfig, debugging;
18
+
19
+ const debug = (...args) => {
20
+ if (!debugging)
21
+ debugging = require('dcp/internal/debugging').scope('dcp-worker');
22
+ if (debugging())
23
+ console.debug('dcp-worker:', ...args);
24
+ };
25
+
21
26
  const EXIT_UNHANDLED = 5;
22
27
 
23
28
  /* Setup the telnet REPL up early to ensure early-failure log messages are captured */
@@ -29,11 +34,11 @@ const replHelpers = {
29
34
  },
30
35
  commands: {
31
36
  report: printReport,
32
- kill: processExit,
37
+ kill: process.exit,
33
38
  die: () => worker && worker.stop()
34
39
  },
35
40
  };
36
- telnetd.init(replHelpers);
41
+ require('../lib/remote-console').init(replHelpers);
37
42
 
38
43
  /* Initialize dcp-client with local config defaults and run the main function. DCP_CONFIG_COOKIE becomes dcpConfig.cookie. */
39
44
  process.env.DCP_CONFIG_COOKIE = (Math.random().toString(16)).slice(2) + '-' + process.pid + '-' + Date.now();
@@ -43,6 +48,7 @@ function parseCliArgs()
43
48
  {
44
49
  var defaultPidFileName;
45
50
 
51
+ dcpConfig = require('dcp/dcp-config');
46
52
  defaultPidFileName = require('../lib/pidfile').getDefaultPidFileName(dcpConfig.worker.pidfile);
47
53
 
48
54
  const cliArgs = require('dcp/cli')
@@ -92,21 +98,18 @@ function parseCliArgs()
92
98
  },
93
99
  priorityOnly: {
94
100
  alias: 'P',
95
- hidden: true,
96
101
  describe: 'Set the priority mode [deprecated]',
97
102
  type: 'boolean',
98
103
  default: false
99
104
  },
100
105
  'job-id': {
101
106
  alias: 'j',
102
- hidden: true,
103
107
  describe: 'Restrict worker to a specific job (use N times for N jobs)',
104
108
  type: 'array',
105
109
  },
106
110
 
107
111
  join: {
108
112
  alias: 'g',
109
- hidden: true,
110
113
  describe: 'Join compute group; the format is "joinKey,joinSecret" or "joinKey,eh1-joinHash"',
111
114
  type: 'array'
112
115
  },
@@ -117,27 +120,22 @@ function parseCliArgs()
117
120
 
118
121
  leavePublicGroup: {
119
122
  type: 'boolean',
120
- hidden: true,
121
- describe: 'Do not fetch slices from public compute group.',
122
- default: undefined,
123
+ describe: 'Do not fetch slices from public compute group. Ignored if --publicGroupFallback is set',
124
+ default: false,
123
125
  },
124
-
125
126
  publicGroupFallback: {
126
- hidden: true,
127
127
  describe: 'If set, worker will prefer private groups but fall back on the public group if no preferred work is available',
128
128
  type: 'boolean',
129
- default: 'undefined',
130
- defaultDescription: undefined,
129
+ default: 'false',
130
+ defaultDescription: false,
131
131
  },
132
132
 
133
133
  identityKey: {
134
- hidden: true,
135
134
  describe: 'Identity key, in hex format',
136
135
  type: 'string',
137
136
  group: 'Identity options',
138
137
  },
139
138
  identityKeystore: {
140
- hidden: true,
141
139
  describe: 'Identity keystore, in json format',
142
140
  type: 'string',
143
141
  group: 'Identity options',
@@ -149,40 +147,30 @@ function parseCliArgs()
149
147
  group: 'Output options',
150
148
  },
151
149
  eventDebug: {
152
- hidden: true,
150
+ hide: true,
153
151
  describe: 'If set, dump all sandbox and worker events',
154
152
  },
155
153
 
156
154
  logfile: {
157
- describe: 'Path to log file',
155
+ describe: 'Path to log file (if --output=file)',
158
156
  type: 'string',
159
157
  group: 'Log File output options',
160
- default: path.resolve('../log/dcp-worker.log'),
161
158
  },
162
159
  syslogAddress: {
163
- describe: 'Address of syslog server',
160
+ describe: 'Address of rsyslog server (if --output=syslog)',
164
161
  type: 'string',
165
162
  group: 'Syslog output options',
166
- default: 'loghost',
167
- },
168
- syslogFacility: {
169
- describe: 'Name of syslog facility',
170
- type: 'string',
171
- group: 'Syslog output options',
172
- default: 'local7',
173
163
  },
174
164
  syslogTransport: {
175
- describe: 'Transport to connect to use for syslog',
165
+ describe: 'Transport to connect to rsyslog daemon (if --output=syslog)',
176
166
  type: 'string',
177
- choices: ['udp','tcp','unix','tls'],
167
+ choices: ['udp','tcp'],
178
168
  group: 'Syslog output options',
179
- default: 'udp',
180
169
  },
181
170
  syslogPort: {
182
- describe: 'UDP/TCP port to use for syslog',
171
+ describe: 'UDP/TCP port of rsyslog server',
183
172
  type: 'number',
184
173
  group: 'Syslog output options',
185
- default: 514,
186
174
  },
187
175
 
188
176
  allowedOrigins: {
@@ -214,8 +202,8 @@ function parseCliArgs()
214
202
 
215
203
  if (cliArgs.dumpConfig)
216
204
  {
217
- console.log(JSON.stringify(require('dcp/dcp-config'), null, 2));
218
- processExit(0);
205
+ console.debug(JSON.stringify(require('dcp/dcp-config'), null, 2));
206
+ process.exit(0);
219
207
  }
220
208
 
221
209
  return cliArgs;
@@ -240,20 +228,6 @@ function addConfig(target, ...objs)
240
228
  Object.assign(target, tmp);
241
229
  }
242
230
 
243
- /**
244
- * Replacement for process.exit() that tries to increase the probability
245
- * that remote log messages will make it out over the network.
246
- */
247
- function processExit()
248
- {
249
- logClosing('debug', 'Exit Code:', process.exitCode || 0);
250
- if (console.close)
251
- console.close();
252
- setImmediate(() => {
253
- process.exit.apply(null, arguments);
254
- });
255
- }
256
-
257
231
  /**
258
232
  * Main program entry point. Assumes DCP client is already initialized and console logging is ready.
259
233
  */
@@ -261,22 +235,21 @@ async function main()
261
235
  {
262
236
  const wallet = require('dcp/wallet');
263
237
  const DCPWorker = require('dcp/worker').Worker;
238
+ const { startWorkerLogger } = require('../lib/startWorkerLogger');
264
239
  const cliArgs = parseCliArgs();
265
240
  const sawOptions = {
266
241
  hostname: cliArgs.hostname,
267
242
  port: cliArgs.port
268
243
  };
269
244
 
270
- telnetd.setMainEval(function mainEval() { return eval(arguments[0]) }); // eslint-disable-line no-eval
271
- require('../lib/startWorkerLogger').init(cliArgs); /* Start remote logger as early as possible */
272
- verifyDefaultConfigIntegrity(); /* Bail before TUI & as early as possible if bad conf */
245
+ verifyDefaultConfigIntegrity();
273
246
 
274
247
  process.on('SIGINT', handleSigDeath);
275
248
  process.on('SIGTERM', handleSigDeath);
276
249
  process.on('SIGQUIT', handleSigDeath);
277
250
  process.on('unhandledRejection', handleUnhandled);
278
251
  process.on('uncaughtException', handleUnhandled);
279
-
252
+
280
253
  let paymentAddress = false
281
254
  || cliArgs.paymentAddress
282
255
  || dcpConfig.worker.paymentAddress
@@ -287,7 +260,7 @@ async function main()
287
260
  if (cliArgs.pidFile)
288
261
  require('../lib/pidfile').write(cliArgs.pidFile);
289
262
 
290
- /* Figure out the worker's identity and put that keystore in the wallet */
263
+ /* Figure out of the worker's identity and put that keystore in the wallet */
291
264
  let identityKeystore = false;
292
265
  if (cliArgs.identityKey)
293
266
  identityKeystore = await new wallet.IdKeystore(cliArgs.identityKey, '');
@@ -305,14 +278,11 @@ async function main()
305
278
  * which were derived from dcpConfig in the first place. defaultOptions are overrideable by the usual
306
279
  * dcpConfig mechanisms, but since they are dynamic (or non-user-facing) they don't come from the
307
280
  * etc/dcp-worker-config.js file that ships with the work.
308
- *
309
- * It is important to never disable leavePublicGroup as a side effect of any other operation, or
310
- * slight configuration errors could have large security impacts.
311
281
  */
312
282
  const dcpWorkerOptions = dcpConfig.worker;
313
283
  const forceOptions = {
314
284
  paymentAddress,
315
- maxWorkingSandboxes: cliArgs.cores,
285
+ leavePublicGroup: cliArgs.leavePublicGroup || dcpConfig.worker.leavePublicGroup || cliArgs.publicGroupFallback || false,
316
286
  };
317
287
  const defaultOptions = {
318
288
  sandboxOptions: {
@@ -320,21 +290,9 @@ async function main()
320
290
  },
321
291
  };
322
292
 
323
- if (cliArgs.leavePublicGroup !== undefined)
324
- forceOptions.leavePublicGroup = mkBool(cliArgs.leavePublicGroup);
325
- if (cliArgs.publicGroupFallback !== undefined)
326
- forceOptions.publicGroupFallback = mkBool(cliArgs.publicGroupFallback);
327
-
328
293
  addConfig(dcpWorkerOptions, defaultOptions, dcpConfig.worker, forceOptions);
329
294
  processCoresAndDensity(dcpWorkerOptions, cliArgs);
330
295
 
331
- /* Support magic value used by Windows screensaver configuration /wg June 2023 */
332
- if (dcpWorkerOptions.leavePublicGroup === 'fallback')
333
- {
334
- dcpWorkerOptions.publicGroupFallback = true;
335
- dcpWorkerOptions.leavePublicGroup = undefined;
336
- }
337
-
338
296
  /* cliArgs.join is the list of compute groups to join */
339
297
  if (cliArgs.join && cliArgs.join.length)
340
298
  {
@@ -367,57 +325,47 @@ async function main()
367
325
  dcpWorkerOptions.watchdogInterval = cliArgs.watchdogInterval;
368
326
 
369
327
  worker = new DCPWorker(identityKeystore, dcpWorkerOptions);
370
- worker.on('error', (...payload) => console.error(...payload));
371
- worker.on('warning', (...payload) => console.warn (...payload));
372
- worker.on('stop', () => { console.log('Worker is stopping') });
373
- worker.on('end', () => { logClosing('log', 'Worker has stopped') });
374
- require('../lib/default-ui-events').hook(worker, cliArgs);
328
+ worker.on('error', (...payload) => console.error(...payload));
329
+ worker.on('warning', (...payload) => console.warn(...payload));
375
330
 
376
- if (cliArgs.outputMode === 'dashboard')
377
- require('../lib/dashboard-tui').init(worker, cliArgs);
378
-
379
331
  /* Let incorrect event-loop references keep us alive when linked with a debug library, but
380
332
  * exit quickly/accurately for production code even when the library isn't perfect.
381
333
  */
382
334
  if (require('dcp/build').config.build !== 'debug')
383
- worker.on('end', processExit);
335
+ worker.on('end', process.exit);
384
336
  else
385
- worker.on('end', () => setTimeout(processExit, getCleanupTimeoutMs()).unref());
337
+ worker.on('end', () => setTimeout(process.exit, getCleanupTimeoutMs()).unref());
386
338
 
387
339
  if (cliArgs.eventDebug)
388
340
  worker.enableDebugEvents = true;
389
341
 
390
- if (dcpWorkerOptions.publicGroupFallback)
342
+ worker.on('stop', () => { console.log('Worker is stopping') });
343
+ worker.on('end', () => { logClosing('log', 'Worker has stopped') });
344
+ startWorkerLogger(worker, cliArgs);
345
+
346
+ require('../lib/remote-console').setMainEval(function mainEval() { return eval(arguments[0]) });
347
+
348
+ // Activate public group fallback
349
+ // If requested by CLI
350
+ // OR if requested by dcpConfig and not forbidden by the cli
351
+ if (cliArgs.publicGroupFallback
352
+ || (dcpConfig.worker?.leavePublicGroup === 'fallback'
353
+ && typeof cliArgs.publicGroupFallback !== false))
391
354
  {
392
- if (dcpWorkerOptions.leavePublicGroup)
393
- console.warn(' ! Public Group fallback has been requested, but the public group is blocked by local configuration');
355
+ dcpWorkerOptions.publicGroupFallback = true;
356
+
357
+ // If local config blocks the public group, then complain instead of activating fallback
358
+ if (dcpConfig.worker?.leavePublicGroup === true)
359
+ {
360
+ console.warn('* Public Group fallback has been requested, but the public group is blocked by local configuration');
361
+ }
394
362
  else
395
363
  {
396
- /* Enable public group fallback - this currently works by enabling or disabling the public group
397
- * on the next fetch based on whether or not the most recent fetch was an empty task or not.
398
- */
399
- worker.on('fetch', fetchEventHandler);
400
-
401
- function fetchEventHandler(ev)
402
- {
403
- var slicesFetched;
404
-
405
- if (ev instanceof Error)
406
- {
407
- console.error('Error fetching task:', ev);
408
- return;
409
- }
410
-
411
- if (typeof ev === 'number' || typeof ev === 'string') /* <= June 2023 Worker events: remove ~ Sep 2023 /wg */
412
- slicesFetched = ev;
413
- else
414
- {
415
- const task = ev;
416
- slicesFetched = task.slices.length;
417
- }
418
-
419
- dcpWorkerOptions.leavePublicGroup = Boolean(slicesFetched > 0);
420
- }
364
+ worker.on('fetchend', slicesFetched => {
365
+ // Iff we got work in this fetch, then leave the public group for the
366
+ // next fetch
367
+ dcpConfig.worker.leavePublicGroup = Boolean(slicesFetched > 0);
368
+ });
421
369
  }
422
370
  }
423
371
 
@@ -443,23 +391,21 @@ async function main()
443
391
 
444
392
  if (dcpWorkerOptions.jobAddresses?.length > 0)
445
393
  introBanner += ` * Processing only ${qty(dcpWorkerOptions.jobAddresses, 'job')} ` + dcpWorkerOptions.jobAddresses.join(', ') + '\n';
446
- if (dcpWorkerOptions.computeGroups && Object.keys(dcpWorkerOptions.computeGroups).length > 0)
394
+ if (dcpWorkerOptions.computeGroups?.length > 0)
447
395
  introBanner += ` . Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')} ` + dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', ') + '\n';
448
396
  if (dcpWorkerOptions.publicGroupFallback)
449
397
  introBanner += ' . Falling back on public group when preferred groups have no work' + '\n';
450
- if (dcpWorkerOptions.leavePublicGroup)
398
+ else if (dcpWorkerOptions.leavePublicGroup)
451
399
  introBanner += ' . Leaving the public compute group' + '\n';
452
400
  if (dcpWorkerOptions.cores)
453
- introBanner += ` . Configured Cores: ${dcpWorkerOptions.cores.cpu},${dcpWorkerOptions.cores.gpu}\n`
401
+ introBanner += ` . Target cores: ${JSON.stringify(dcpWorkerOptions.cores)}\n`;
454
402
  else
455
403
  introBanner += ` . Target core density: ${JSON.stringify(dcpWorkerOptions.defaultCoreDensity)}\n`;
456
404
  if (cliArgs.verbose)
457
405
  introBanner += ` + Verbosity level: ${cliArgs.verbose}` + '\n';
458
406
  if (cliArgs.eventDebug)
459
407
  introBanner += ' + Event debug on' + '\n';
460
- if (telnetd.hasOwnProperty('port'))
461
- introBanner += ` ! telnetd listening on port ${telnetd.port}\n`;
462
-
408
+
463
409
  introBanner += ' . Supervisor version: ' + worker.supervisorVersion;
464
410
  introBanner += ' . Output mode: ' + cliArgs.outputMode + '\n';
465
411
  introBanner += ' * Ready' + '\n';
@@ -472,7 +418,7 @@ async function main()
472
418
  if (cliArgs.outputMode !== 'dashboard')
473
419
  setInterval(printReport, parseFloat(cliArgs.reportInterval) * 1000).unref();
474
420
  else
475
- console.warn('Ignoring --reportInterval in dashboard output mode');
421
+ console.log('Ignoring --reportInterval in dashboard output mode');
476
422
  }
477
423
 
478
424
  /* Start the worker. Normal process exit happens by virtue of the worker<end> event */
@@ -511,9 +457,9 @@ function processCoresAndDensity (dcpWorkerOptions, cliArgs)
511
457
  parseArg('cores');
512
458
 
513
459
  if (dcpWorkerOptions.cores)
514
- debugging() && console.debug('dcp-worker: cores =', dcpWorkerOptions.cores);
460
+ debug('cores = ', dcpWorkerOptions.cores);
515
461
  else
516
- debugging() && console.debug('dcp-worker: core density =', dcpWorkerOptions.defaultCoreDensity);
462
+ debug('core density = ', dcpWorkerOptions.defaultCoreDensity);
517
463
  }
518
464
 
519
465
  /**
@@ -524,7 +470,9 @@ function logClosing(facility, ...message)
524
470
  {
525
471
  var screen = require('../lib/worker-loggers/dashboard').screen;
526
472
 
527
- if (screen)
473
+ if (!screen)
474
+ console[facility](message);
475
+ else
528
476
  {
529
477
  /* Turn off fullscreen TUI and resume "normal" console logging.
530
478
  * FUTURE: dashboard API should know how to unregister its hook so that we don't have to clobber
@@ -533,11 +481,10 @@ function logClosing(facility, ...message)
533
481
  screen.log(...message);
534
482
  screen.destroy();
535
483
  screen = false;
536
- console = new (require('console').Console)(process); // eslint-disable-line no-global-assign
537
- telnetd.reintercept();
484
+ console = new (require('console').Console)(process);
485
+ require('../lib/remote-console').reintercept();
486
+ console[facility].call(null, ...message);
538
487
  }
539
-
540
- console[facility](...message);
541
488
  }
542
489
 
543
490
  /**
@@ -546,7 +493,7 @@ function logClosing(facility, ...message)
546
493
  * the worker must be restarted. This handler does its best to report the rejection and give the worker a few
547
494
  * seconds in which to attempt to return slices to the scheduler before it gives up completely.
548
495
  */
549
- function handleUnhandled(error)
496
+ async function handleUnhandled(error)
550
497
  {
551
498
  var _worker = worker;
552
499
  worker = false;
@@ -555,21 +502,21 @@ function handleUnhandled(error)
555
502
 
556
503
  try
557
504
  {
558
- logClosing('error', error);
559
- } catch(e) {} // eslint-disable-line no-empty
505
+ logClosing(error);
506
+ } catch(e) {};
560
507
 
561
508
  if (!_worker)
562
509
  console.error('trapped unhandled error:', error)
563
510
  else
564
511
  {
565
512
  console.error('trapped unhandled error -- stopping worker:', error);
566
- _worker.on('end', processExit);
513
+ _worker.on('end', process.exit);
567
514
  _worker.stop();
568
515
  }
569
516
 
570
517
  setTimeout(() => {
571
518
  logClosing('error', 'handleFatalError timeout - exiting now');
572
- processExit();
519
+ process.exit();
573
520
  }, getCleanupTimeoutMs()).unref();
574
521
 
575
522
  try {
@@ -579,7 +526,7 @@ function handleUnhandled(error)
579
526
  fs.appendFileSync(process.env.DCP_WORKER_UNHANDLED_REJECTION_LOG,
580
527
  `${Date.now()}: ${error.message}\n${error.stack}\n\n`);
581
528
  }
582
- } catch(e) {} // eslint-disable-line no-empty
529
+ } catch(e) {};
583
530
  }
584
531
 
585
532
  /** print the slice report via console.log */
@@ -676,14 +623,14 @@ function handleSigDeath(signalName, signal)
676
623
  process.off(signalName, handleSigDeath);
677
624
 
678
625
  if (!worker)
679
- console.warn(`trapped ${signalName}, signal ${signal}`);
626
+ console.error(`trapped ${signalName}, signal ${signal}`);
680
627
  else
681
628
  {
682
- console.warn(`trapped ${signalName}, signal ${signal} -- stopping worker`);
629
+ console.error(`trapped ${signalName}, signal ${signal} -- stopping worker`);
683
630
  worker.stop(signalName === 'SIGQUIT');
684
631
  }
685
632
 
686
- setTimeout(() => processExit(signal - 128), getCleanupTimeoutMs()).unref();
633
+ setTimeout(() => process.exit(signal - 128), getCleanupTimeoutMs()).unref();
687
634
  }
688
635
 
689
636
  /**
@@ -703,7 +650,7 @@ function getCleanupTimeoutMs()
703
650
  cleanupTimeout = defaultCT;
704
651
  if (!getCleanupTimeoutMs.warned)
705
652
  {
706
- console.error(`warning: dcpConfig.worker.cleanupTimeout is not a number (${dcpConfig.worker.cleanupTimeout})`);
653
+ console.warn(`warning: dcpConfig.worker.cleanupTimeout is not a number (${dcpConfig.worker.cleanupTimeout})`);
707
654
  getCleanupTimeoutMs.warned = true;
708
655
  }
709
656
  }
@@ -725,14 +672,14 @@ function verifyDefaultConfigIntegrity()
725
672
 
726
673
  if (!fs.existsSync(md5sumPath))
727
674
  {
728
- console.error(chalk.bold.red(` ! warning: ${md5sumPath} not found; cannot verify configuration integrity`));
675
+ console.log(chalk.bold.red(` ! warning: ${md5sumPath} not found; cannot verify configuration integrity`));
729
676
  require('dcp/utils').sleep(2);
730
677
  }
731
678
  else
732
679
  {
733
680
  const originalMd5sum = fs.readFileSync(md5sumPath, 'ascii');
734
681
  const actualMd5sum = crypto.createHash('md5')
735
- .update(fs.readFileSync(workerConfPath))
682
+ .update(fs.readFileSync(workerConfPath, 'ascii'))
736
683
  .digest('hex');
737
684
 
738
685
  if (!originalMd5sum.startsWith(actualMd5sum))
@@ -747,7 +694,7 @@ function verifyDefaultConfigIntegrity()
747
694
  console.warn(' - the Windows Registry');
748
695
 
749
696
  if (require('dcp/build').config.build !== 'debug')
750
- processExit(1);
697
+ process.exit(1);
751
698
 
752
699
  console.log(chalk.bold.red.inverse("If this wasn't a debug build, the worker would exit now."));
753
700
  require('dcp/utils').sleep(2);
@@ -757,23 +704,6 @@ function verifyDefaultConfigIntegrity()
757
704
  if (dcpConfig.cookie !== process.env.DCP_CONFIG_COOKIE || !dcpConfig.cookie)
758
705
  {
759
706
  console.error(' ! DCP Worker default configuration was not loaded; exiting.');
760
- processExit(1);
707
+ process.exit(1);
761
708
  }
762
709
  }
763
-
764
- /* thunk - ensures global debugging() symbol always available even if called before dcp-client init */
765
- function debugging()
766
- {
767
- require('dcp-client');
768
- debugging = require('dcp/internal/debugging').scope('dcp-worker');
769
- return debugging.apply(this, arguments);
770
- }
771
-
772
- /**
773
- * Cast b to boolean such that 'false' becomes false, falsey things become false, and everything else
774
- * becomes true.
775
- */
776
- function mkBool(b)
777
- {
778
- return Boolean(b) && (b !== 'false');
779
- }
package/docs/CODEOWNERS CHANGED
@@ -18,11 +18,9 @@
18
18
  /package-lock.json @eroosenmaallen
19
19
 
20
20
  [Wes]
21
- /npm-hooks/ @wesgarland
22
21
  /README.md @wesgarland
23
22
  /docs/ @wesgarland
24
23
  /.eslintrc.json @wesgarland
25
- /.npmrc @wesgarland
26
24
  /.tidelift @wesgarland
27
25
  /lib/ @wesgarland
28
26
  /LICENSE.md @wesgarland
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
 
3
2
  Object.assign(exports, require('./log'));
4
3
  Object.assign(exports, require('./sandboxes'));
@@ -7,7 +7,6 @@
7
7
  * log component, but features text wrapping and behaves
8
8
  * closer to the built-in console log methods.
9
9
  */
10
- 'use strict';
11
10
 
12
11
  const { Box } = require('blessed');
13
12
 
@@ -6,7 +6,6 @@
6
6
  * @author Sam Cantor
7
7
  * @date Nov 2020
8
8
  */
9
- 'use strict';
10
9
 
11
10
  exports.check = function checkSchedulerVersion$$check(quiet)
12
11
  {
package/lib/pidfile.js CHANGED
@@ -21,7 +21,7 @@ const path = require('path');
21
21
  *
22
22
  * @param {string} filename the location of the pid file
23
23
  */
24
- exports.write = function pidfile$$write(filename)
24
+ exports.write = async function pidfile$$write(filename)
25
25
  {
26
26
  var fd;
27
27
 
@@ -47,7 +47,7 @@ function daemonEval()
47
47
 
48
48
  function callbackTelnet(port, client, registry) {
49
49
  client.unref();
50
- debugging() && console.notice(' ! telnetd - listening on port', port);
50
+ debugging() && console.debug(' ! telnetd - listening on port', port);
51
51
  }
52
52
 
53
53
  /**
@@ -76,16 +76,8 @@ exports.init = function remoteConsole$$init(...commands)
76
76
 
77
77
  console.warn('*** Enabling telnet daemon on port', port, '(security risk) ***');
78
78
 
79
- if (port !== 0)
80
- exports.port = port;
81
- else
82
- {
83
- /* telnet-console library does not properly support port 0 so we mostly work-around here */
84
- exports.port = Math.floor(1023 + (Math.random() * (63 * 1024)));
85
- }
86
-
87
79
  ci = require('telnet-console').start({
88
- port: exports.port,
80
+ port,
89
81
  callbackTelnet,
90
82
  eval: daemonEval,
91
83
  histfile: edcFilename + '.history',