11 lines
315 B
TypeScript
11 lines
315 B
TypeScript
import {spawn} from 'child_process';
|
|
import {readFileSync} from 'node:fs';
|
|
|
|
export function runInBackground(command: string, args?: string[]) {
|
|
const proc = spawn(command, args ?? [], {detached: true, stdio: 'ignore'});
|
|
proc.unref();
|
|
return proc.pid;
|
|
}
|
|
|
|
export const getStdin = () => readFileSync(0, 'utf8');
|