UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

20 lines 675 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exitSafe = exitSafe; /** * Exits after draining stdout/stderr. When Node.js writes to a pipe it does so * asynchronously; calling process.exit() directly can truncate pending output. * Falls back to a forced exit after 1 min in case a drain callback never fires. */ function exitSafe(code = 0) { let pending = 2; const done = () => { if (--pending === 0) { process.exit(code); } }; process.stdout.write('', done); process.stderr.write('', done); setTimeout(() => process.exit(code), 60_000).unref(); } //# sourceMappingURL=proc.js.map