MCPcopy Index your code
hub / github.com/coder/mux / buildSpawnCommand

Function buildSpawnCommand

src/node/runtime/backgroundCommands.ts:106–115  ·  view source on GitHub ↗
(options: SpawnCommandOptions)

Source from the content-addressed store, hash-verified

104 * Returns PID via echo. With set -m, PID === PGID (process is its own group leader).
105 */
106export 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.

Callers 2

spawnProcessFunction · 0.90

Calls 1

shellQuoteFunction · 0.90

Tested by

no test coverage detected