dashcam 1.0.1-beta.31 → 1.0.1-beta.32
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/dashcam.js +4 -1
- package/lib/processManager.js +14 -4
- package/package.json +1 -1
package/bin/dashcam.js
CHANGED
|
@@ -136,7 +136,10 @@ async function recordingAction(options, command) {
|
|
|
136
136
|
log('Use "dashcam status" to check progress');
|
|
137
137
|
log('Use "dashcam stop" to stop recording and upload');
|
|
138
138
|
|
|
139
|
-
//
|
|
139
|
+
// Close stdout/stderr and exit immediately to prevent blocking
|
|
140
|
+
// when called from automation scripts with piped output
|
|
141
|
+
process.stdout.end();
|
|
142
|
+
process.stderr.end();
|
|
140
143
|
process.exit(0);
|
|
141
144
|
|
|
142
145
|
} catch (error) {
|
package/lib/processManager.js
CHANGED
|
@@ -238,11 +238,20 @@ class ProcessManager {
|
|
|
238
238
|
const __dirname = path.dirname(__filename);
|
|
239
239
|
const backgroundScript = path.join(__dirname, '..', 'bin', 'dashcam-background.js');
|
|
240
240
|
|
|
241
|
-
//
|
|
242
|
-
const
|
|
241
|
+
// On Windows, we need to ensure stdio is completely detached
|
|
242
|
+
const isWindows = process.platform === 'win32';
|
|
243
|
+
const spawnOptions = {
|
|
243
244
|
detached: true,
|
|
244
245
|
stdio: 'ignore'
|
|
245
|
-
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// On Windows, also create a new process group to fully detach
|
|
249
|
+
if (isWindows) {
|
|
250
|
+
spawnOptions.windowsHide = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Spawn a detached background process
|
|
254
|
+
const child = spawn(process.execPath, [backgroundScript, JSON.stringify(options)], spawnOptions);
|
|
246
255
|
|
|
247
256
|
// Unref so the parent process can exit
|
|
248
257
|
child.unref();
|
|
@@ -254,7 +263,8 @@ class ProcessManager {
|
|
|
254
263
|
|
|
255
264
|
logger.info('Background process spawned successfully', {
|
|
256
265
|
pid,
|
|
257
|
-
backgroundScript
|
|
266
|
+
backgroundScript,
|
|
267
|
+
platform: process.platform
|
|
258
268
|
});
|
|
259
269
|
|
|
260
270
|
// Wait a moment for the background process to write its status
|