Software: Apache. PHP/7.3.33 uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) Safe-mode: OFF (not secure) /opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/node_modules.bundled/foreground-child/dist/esm/ drwxr-xr-x |
Viewing file: Select action/file-type: // this spawns a child process that listens for SIGHUP when the // parent process exits, and after 200ms, sends a SIGKILL to the // child, in case it did not terminate. import { spawn } from 'child_process'; const watchdogCode = String.raw ` const pid = parseInt(process.argv[1], 10) process.title = 'node (foreground-child watchdog pid=' + pid + ')' if (!isNaN(pid)) { let barked = false // keepalive const interval = setInterval(() => {}, 60000) const bark = () => { clearInterval(interval) if (barked) return barked = true process.removeListener('SIGHUP', bark) setTimeout(() => { try { process.kill(pid, 'SIGKILL') setTimeout(() => process.exit(), 200) } catch (_) {} }, 500) }) process.on('SIGHUP', bark) } `; /** * Pass in a ChildProcess, and this will spawn a watchdog process that * will make sure it exits if the parent does, thus preventing any * dangling detached zombie processes. * * If the child ends before the parent, then the watchdog will terminate. */ export const watchdog = (child) => { let dogExited = false; const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], { stdio: 'ignore', }); dog.on('exit', () => (dogExited = true)); child.on('exit', () => { if (!dogExited) dog.kill('SIGKILL'); }); return dog; }; //# sourceMappingURL=watchdog.js.map |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0037 ]-- |