kill-sync
Version:
Cross-platform kill command. Supports recusive/tree-kill in a synchronous manner.
21 lines • 702 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const treekill_1 = require("./treekill");
const killSync = (pid, signal, recursive = false) => {
signal = signal !== null && signal !== void 0 ? signal : 'SIGTERM';
if (!recursive) {
return (0, treekill_1.killPid)(pid, signal);
}
switch (process.platform) {
case 'win32':
(0, child_process_1.execSync)(`taskkill /pid ${pid} /T /F`);
break;
case 'darwin':
default:
(0, treekill_1.treeKill)(pid, signal);
break;
}
};
exports.default = killSync;
//# sourceMappingURL=kill.js.map