(options: SpawnCommandOptions)
| 104 | * Returns PID via echo. With set -m, PID === PGID (process is its own group leader). |
| 105 | */ |
| 106 | export function buildSpawnCommand(options: SpawnCommandOptions): string { |
| 107 | const bash = options.bashPath ?? "bash"; |
| 108 | const quotePath = options.quotePath ?? shellQuote; |
| 109 | |
| 110 | return ( |
| 111 | `(set -m; nohup ${shellQuote(bash)} -c ${shellQuote(options.wrapperScript)} ` + |
| 112 | `> ${quotePath(options.outputPath)} 2>&1 ` + |
| 113 | `< /dev/null & echo $!)` |
| 114 | ); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Build the terminate command for killing a process group. |
no test coverage detected