test.cb('remove temporary files on cancel', t => { t.plan(1); const cp = spawn('../cli.js', ['https://sindresorhus.com', '320x240']); cp.on('exit', () => { t.false(fs.existsSync('sindresorhus.com-320x240.png')); t.end(); }); setTimeout(() => { cp.kill('SIGINT'); }, 500); });
// Setup up a special shutdown function that's called when encountering an error // so that we always shut down the camera stream properly const kill = (err) => { cameraStream.kill(); throw err; }
ipcMain.on('stop-odas', function(event) { exports.odas_process.kill('SIGINT') exports.odas_process = undefined console.log('received stop command') })
setTimeout(function() { if (active) return; child.removeAllListeners(); child.kill('SIGINT'); // Let tor exit gracefully, since we try to bind on // the same port setTimeout(function() { resolve(Tor.spawn(port, dir, retryTimeout)); }, 1000); }, retryTimeout)
var listener = function(data) { if (data.toString('utf8').indexOf('Done') === -1) return; child.stdout.removeListener('data', listener); clearTimeout(timeout); active = true; process.on('exit', function() { child.kill('SIGINT'); }); resolve(new Tor(child, port, dir)); }
dispose() { this.disposing = true const stopWatcher = new Promise(resolve => { this.watcher.close(resolve) }) return stopWatcher.then(() => { if (this.server) this.server.kill() }) }
pause() { this.paused = true; if (this.output === '-') { this.proc.stdout.pause(); return; } if (['win32', 'win64'].includes(os.platform())) { this.proc.stdin.write('c'); } else { this.proc.kill('SIGSTOP'); } }
kill () { console.log('kill() [pid:%d]', this._process.pid); this._process.kill('SIGINT'); }
/** * @returns Promise */ stop() { get(this.stop_url, {}, () => {}); this._setup.process().stdin.pause(); this._setup.process().kill(); return Promise.resolve(); }
/** * Internal cleanup method to clean up timers and processes. */ cleanup() { this.spawnedCommand.kill(); clearInterval(this.pollOutput); clearTimeout(this.fallbackTimeout); }
// Closes the engine. Stops the Prolog process. close() { this.swipl.kill(); this.state.setClosed(); }
// ---- trap the SIGINT and reset before exit process.on('SIGINT', function () { ledapi.kill('SIGINT'); });
resume() { this.paused = false; if (this.output === '-') { this.proc.stdout.resume(); } if (['win32', 'win64'].includes(os.platform())) { this.proc.stdin.write('\n'); } else { this.proc.kill('SIGCONT'); } }
stop() { subprocess.kill(); }
kill () { console.log('kill() [pid:%d]', this._process.pid); this._process.kill('SIGINT'); }