(filename)
| 9 | // When CMD is used to launch a process and CMD is killed too quickly, the |
| 10 | // process can stay behind running in suspended state, never completing. |
| 11 | function cleanupStaleProcess(filename) { |
| 12 | if (!common.isWindows) { |
| 13 | return; |
| 14 | } |
| 15 | process.once('beforeExit', () => { |
| 16 | const basename = filename.replace(/.*[/\\]/g, ''); |
| 17 | try { |
| 18 | execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [ |
| 19 | 'process', |
| 20 | 'where', |
| 21 | `commandline like '%${basename}%child'`, |
| 22 | 'delete', |
| 23 | '/nointeractive', |
| 24 | ]); |
| 25 | } catch { |
| 26 | // Ignore failures, there might not be any stale process to clean up. |
| 27 | } |
| 28 | }); |
| 29 | } |
| 30 | |
| 31 | // This should keep the child process running long enough to expire |
| 32 | // the timeout. |
no test coverage detected
searching dependent graphs…