tnp 13.0.80 → 13.0.81

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/bin/start.js CHANGED
@@ -62,6 +62,7 @@ if (typeof useWorker !== 'undefined') {
62
62
  global.hideLog = true;
63
63
  global.verboseLevel = 0;
64
64
  var verboseLevel = process.argv.find(a => a.startsWith('-verbose='));
65
+ var childProc = process.argv.find(a => a.startsWith('-childproc'));
65
66
  if (typeof verboseLevel !== 'undefined') {
66
67
  global.hideLog = false;
67
68
  verboseLevel = Number(verboseLevel.replace('-verbose=', ''));
@@ -105,7 +106,7 @@ if (startSpinner && isNaN(process.ppid)) {
105
106
  startSpinner = false;
106
107
  }
107
108
 
108
- if(process.platform === 'win32') {
109
+ if (process.platform === 'win32') {
109
110
  startSpinner = false;
110
111
  }
111
112
 
@@ -125,11 +126,9 @@ if (startSpinner) {
125
126
  process.send && process.send('stop-spinner')
126
127
  }
127
128
  }
128
- process.on("SIGINT", function () {
129
- process.exit(1);
130
- });
131
129
  }
132
130
  process.argv = process.argv.filter(a => a !== '-spinner');
131
+ process.argv = process.argv.filter(a => a !== '-childproc');
133
132
  process.argv = process.argv.filter(f => !!f);
134
133
 
135
134
  if (startSpinner) {
@@ -146,7 +145,7 @@ if (startSpinner) {
146
145
 
147
146
 
148
147
  const command = `${!!frameworkName ? frameworkName : 'tnp'}`;
149
- const argsToCHildProc = `${orgArgv.slice(2).join(' ')} ${spinnerIsDefault ? '-spinner' : ''}`.split(' ');
148
+ const argsToCHildProc = `${orgArgv.slice(2).join(' ')} ${spinnerIsDefault ? '-spinner' : ''} -childproc`.split(' ');
150
149
  // !global.hideLog && console.log(`worker command: ${command} ${argsToCHildProc.join(' ')}`);
151
150
  const proc = spawn(command,
152
151
  argsToCHildProc
@@ -155,6 +154,18 @@ if (startSpinner) {
155
154
  stdio: [0, 1, 2, 'ipc'],
156
155
  cwd: process.cwd(),
157
156
  });
157
+
158
+
159
+ proc.on('exit', (code) => {
160
+ // console.info('-- clean exit ---')
161
+ process.exit(code)
162
+ });
163
+
164
+ // proc.on('disconnect', (code) => {
165
+ // console.info('-- clean exit ---')
166
+ // process.exit(code)
167
+ // });
168
+
158
169
  proc.on('message', message => {
159
170
  if (message === 'start-spinner') {
160
171
  spinner.start();
@@ -179,11 +190,11 @@ if (startSpinner) {
179
190
  // proc.stderr.on('error', (data) => {
180
191
  // process.stderr.write(data);
181
192
  // })
182
- proc.on('exit', (code) => {
183
- // const end = new Date() - start
184
- // console.info('Execution time: %dms', end)
185
- process.exit(code);
186
- })
193
+ // proc.on('exit', (code) => {
194
+ // // const end = new Date() - start
195
+ // // console.info('Execution time: %dms', end)
196
+ // process.exit(code);
197
+ // })
187
198
  //#endregion
188
199
  // process.stdin.resume();
189
200
  } else {
@@ -271,6 +282,26 @@ if (startSpinner) {
271
282
  //#endregion
272
283
  }
273
284
  //#endregion
285
+
286
+ // function killProcesses() {
287
+ // console.log("SENDING KILL")
288
+ // var toKill = (global.firedevChildProcesses || []);
289
+ // for (let index = 0; index < toKill.length; index++) {
290
+ // const procFn = toKill[index];
291
+ // if (typeof procFn === 'function') {
292
+ // procFn();
293
+ // }
294
+ // }
295
+ // }
296
+
297
+ // process.on('SIGINT', () => {
298
+ // killProcesses();
299
+ // })
300
+ // process.on('SIGTERM', () => {
301
+ // killProcesses();
302
+ // })
303
+
304
+
274
305
  start(process.argv, 'tnp', mode, !!spinner ? spinner : void 0);
275
306
  }
276
307