dashcam 1.3.23 → 1.3.24
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/lib/processManager.js +16 -0
- package/package.json +1 -1
package/lib/processManager.js
CHANGED
|
@@ -353,6 +353,10 @@ class ProcessManager {
|
|
|
353
353
|
const logStream = fs.createWriteStream(logFile, { flags: 'a' });
|
|
354
354
|
|
|
355
355
|
logger.info('Background process log file', { logFile });
|
|
356
|
+
console.log('[ProcessManager] Log file created:', logFile);
|
|
357
|
+
console.log('[ProcessManager] Node path:', nodePath);
|
|
358
|
+
console.log('[ProcessManager] Background script:', backgroundScriptPath);
|
|
359
|
+
console.log('[ProcessManager] Options:', optionsJson);
|
|
356
360
|
|
|
357
361
|
// Spawn the background process with proper detachment
|
|
358
362
|
const child = spawn(
|
|
@@ -366,11 +370,23 @@ class ProcessManager {
|
|
|
366
370
|
}
|
|
367
371
|
);
|
|
368
372
|
|
|
373
|
+
// Handle spawn errors
|
|
374
|
+
child.on('error', (error) => {
|
|
375
|
+
console.error('[ProcessManager] Spawn error:', error);
|
|
376
|
+
logger.error('Failed to spawn background process', { error: error.message, stack: error.stack });
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
child.on('exit', (code, signal) => {
|
|
380
|
+
console.log('[ProcessManager] Background process exited', { code, signal, pid: child.pid });
|
|
381
|
+
logger.info('Background process exited', { code, signal, pid: child.pid });
|
|
382
|
+
});
|
|
383
|
+
|
|
369
384
|
// Unref to allow parent to exit independently
|
|
370
385
|
child.unref();
|
|
371
386
|
|
|
372
387
|
const pid = child.pid;
|
|
373
388
|
|
|
389
|
+
console.log('[ProcessManager] Background process spawned with PID:', pid);
|
|
374
390
|
logger.info('Background process spawned', {
|
|
375
391
|
pid,
|
|
376
392
|
logFile,
|