@ascot/process
Advanced tools
Comparing version 2.0.4 to 2.0.5
{ | ||
"name": "@ascot/process", | ||
"description": "Tools for managing processes, powered by ascot", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
/// <reference types="node" /> | ||
import { ChildProcess } from "child_process"; | ||
import { processExists } from "process-exists"; | ||
export declare namespace Process { | ||
const exists: typeof processExists; | ||
const exists: { | ||
(input: string | number): Promise<boolean>; | ||
all(input: readonly (string | number)[]): Promise<Map<string | number, boolean>>; | ||
filterExists(input: readonly (string | number)[]): (string | number)[]; | ||
}; | ||
function kill(proc: ChildProcess, signal?: NodeJS.Signals): Promise<void>; | ||
} |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.Process = void 0; | ||
const process_exists_1 = require("process-exists"); | ||
const process_exists_1 = __importDefault(require("process-exists")); | ||
const log_1 = __importDefault(require("@ascot/log")); | ||
@@ -13,5 +13,5 @@ const time_1 = __importDefault(require("@ascot/time")); | ||
(function (Process) { | ||
Process.exists = process_exists_1.processExists; | ||
Process.exists = process_exists_1.default; | ||
async function kill(proc, signal) { | ||
if (!await (0, process_exists_1.processExists)(proc.pid)) | ||
if (!await (0, process_exists_1.default)(proc.pid)) | ||
return; // allready killed | ||
@@ -22,3 +22,3 @@ let exited = false; | ||
let tm = setTimeout(async () => { | ||
if (!await (0, process_exists_1.processExists)(proc.pid)) | ||
if (!await (0, process_exists_1.default)(proc.pid)) | ||
return; // allready killed | ||
@@ -31,3 +31,3 @@ log_1.default.warn("Process " + log_1.default.colors.gray("#" + proc.pid) + " did not exit in time. Forcing exit..."); | ||
proc.kill(signal || "SIGINT"); | ||
while (await (0, process_exists_1.processExists)(proc.pid) && !exited) | ||
while (await (0, process_exists_1.default)(proc.pid) && !exited) | ||
await time_1.default.wait(500); | ||
@@ -34,0 +34,0 @@ if (tm) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3083
62