@nginstack/engine-node 60.0.4 → 60.0.5

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.
Files changed (2) hide show
  1. package/lib/Engine.js +29 -18
  2. package/package.json +2 -2
package/lib/Engine.js CHANGED
@@ -247,6 +247,9 @@ class Engine {
247
247
  request.get(new URL(ENGINE_DOWNLOAD_URL, httpUrl).toString())
248
248
  .pipe(fs.createWriteStream(this.enginePath))
249
249
  .on('close', () => {
250
+ if (os.platform() != 'win32') {
251
+ fs.chmodSync(path.join(this.installPath, ENGINE_APP), '755');
252
+ }
250
253
  resolve();
251
254
  })
252
255
  .on('error', (reqErr) => {
@@ -323,10 +326,12 @@ class Engine {
323
326
  args.push('--additionalLoggerConfig=\'' + logConfig + '\'');
324
327
  }
325
328
 
326
- this.process_ = child_process.spawn(ENGINE_APP, args, {
327
- cwd: this.installPath,
328
- windowsHide: true
329
- });
329
+ this.process_ = child_process.spawn(path.join(this.installPath, ENGINE_APP),
330
+ args,
331
+ {
332
+ cwd: this.installPath,
333
+ windowsHide: true
334
+ });
330
335
 
331
336
  this.process_.on('error', (err) => {
332
337
  console.error('Error starting Engine process:', err);
@@ -432,21 +437,27 @@ class Engine {
432
437
  sendShutdownCommand_() {
433
438
  if (this.process_) {
434
439
  let forceKill = true;
435
- if (fs.existsSync(this.ngintPath_)) {
436
- try {
437
- console.info('Shutdown command sent to Engine process');
438
- child_process.execFileSync(
439
- this.ngintPath_,
440
- ['shutdown', this.process_.pid, ENGINE_SHUTDOWN_TIMEOUT],
441
- {
442
- cwd: this.installPath,
443
- windowsHide: true
444
- }
445
- );
446
- forceKill = false;
447
- } catch (e) {
448
- console.error('Error stopping Engine', e);
440
+ if (os.platform() == 'win32') {
441
+ if (fs.existsSync(this.ngintPath_)) {
442
+ try {
443
+ console.info('Shutdown command sent to Engine process');
444
+ child_process.execFileSync(
445
+ this.ngintPath_,
446
+ ['shutdown', this.process_.pid, ENGINE_SHUTDOWN_TIMEOUT],
447
+ {
448
+ cwd: this.installPath,
449
+ windowsHide: true
450
+ }
451
+ );
452
+ forceKill = false;
453
+ } catch (e) {
454
+ console.error('Error stopping Engine', e);
455
+ }
456
+ } else {
457
+ console.info('ngint was not found');
449
458
  }
459
+ } else {
460
+ process.kill(this.process_.pid, 'SIGTERM');
450
461
  }
451
462
  if (forceKill) {
452
463
  console.info('Kill signal sent to Engine process');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nginstack/engine-node",
3
- "version": "60.0.4",
3
+ "version": "60.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,5 +24,5 @@
24
24
  "thread-sleep": "^2.2.0",
25
25
  "tmp": "^0.2.1"
26
26
  },
27
- "gitHead": "04220d66e188e03f53186458381d4303124a227a"
27
+ "gitHead": "ac2f2455aca88917f9e76fa2214f82f9fa9ef1c1"
28
28
  }