-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrades some old packages in project that were causing build issues
- Loading branch information
1 parent
e37682f
commit 8840a18
Showing
8 changed files
with
3,172 additions
and
2,752 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// BSD 2-clause | ||
|
||
import { SpawnOptions } from 'node:child_process'; | ||
|
||
type DaemonizeProcessOpts = { | ||
/** The path to the script to be executed. Default: The current script. */ | ||
script?: string; | ||
/** The command line arguments to be used. Default: The current arguments. */ | ||
arguments?: string[]; | ||
/** The path to the Node.js binary to be used. Default: The current Node.js binary. */ | ||
node?: string; | ||
/** The exit code to be used when exiting the parent process. Default: `0`. */ | ||
exitCode?: number; | ||
} & SpawnOptions; | ||
export declare function daemonizeProcess(opts?: DaemonizeProcessOpts): void; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// BSD 2-clause | ||
|
||
// This is just https://www.npmjs.com/package/daemonize-process | ||
// but they stopped supporting commonjs, and we need commonjs or | ||
// to build via typescript, and I don't have the time to stress | ||
// for hours about a 20 line function! | ||
|
||
import { spawn } from 'node:child_process'; | ||
import { env, cwd, execPath, argv, exit } from 'node:process'; | ||
|
||
const id = "_DAEMONIZE_PROCESS"; | ||
function daemonizeProcess(opts = {}) { | ||
if (id in env) { | ||
delete env[id]; | ||
} else { | ||
const o = { | ||
// spawn options | ||
env: Object.assign(env, opts.env, { [id]: "1" }), | ||
cwd: cwd(), | ||
stdio: "ignore", | ||
detached: true, | ||
// custom options | ||
node: execPath, | ||
script: argv[1], | ||
arguments: argv.slice(2), | ||
exitCode: 0, | ||
...opts | ||
}; | ||
const args = [o.script, ...o.arguments]; | ||
const proc = spawn(o.node, args, o); | ||
proc?.unref?.(); | ||
exit(o.exitCode); | ||
} | ||
} | ||
|
||
export { daemonizeProcess }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters