dashcam 1.0.1-beta.31 → 1.0.1-beta.33
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 +11 -3
- package/package.json +1 -1
package/lib/processManager.js
CHANGED
|
@@ -159,11 +159,19 @@ class ProcessManager {
|
|
|
159
159
|
const isWindows = process.platform === 'win32';
|
|
160
160
|
|
|
161
161
|
if (isWindows) {
|
|
162
|
-
logger.info('Windows detected,
|
|
162
|
+
logger.info('Windows detected, attempting graceful shutdown first');
|
|
163
163
|
try {
|
|
164
|
-
//
|
|
164
|
+
// First try graceful shutdown without /F (force) flag
|
|
165
|
+
// This sends CTRL+C which Node.js can handle
|
|
165
166
|
const { execSync } = await import('child_process');
|
|
166
|
-
|
|
167
|
+
try {
|
|
168
|
+
execSync(`taskkill /PID ${pid} /T`, { stdio: 'ignore', timeout: 5000 });
|
|
169
|
+
logger.info('Sent graceful shutdown signal to process');
|
|
170
|
+
} catch (error) {
|
|
171
|
+
// If graceful shutdown fails or times out, force kill
|
|
172
|
+
logger.warn('Graceful shutdown failed, forcing termination');
|
|
173
|
+
execSync(`taskkill /PID ${pid} /F /T`, { stdio: 'ignore' });
|
|
174
|
+
}
|
|
167
175
|
} catch (error) {
|
|
168
176
|
logger.warn('Failed to kill process with taskkill', { error: error.message });
|
|
169
177
|
}
|