Skip to content

Instantly share code, notes, and snippets.

@silverwind
Last active September 22, 2023 15:50
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save silverwind/d0802f7a919ae86ff25e to your computer and use it in GitHub Desktop.
Save silverwind/d0802f7a919ae86ff25e to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
"use strict";
console.log("This is pid " + process.pid);
setTimeout(function () {
process.on("exit", function () {
require("child_process").spawn(process.argv.shift(), process.argv, {
cwd: process.cwd(),
detached : true,
stdio: "inherit"
});
});
process.exit();
}, 5000);
@sngrl
Copy link

sngrl commented Aug 25, 2021

Only this one solution allow helped me to prevent memory leak in nodejs, argh! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment