MCPcopy Create free account
hub / github.com/Noumena-Network/code / writeEnvLaunchScript

Function writeEnvLaunchScript

src/testing/wrapperTmuxHarness.ts:32–56  ·  view source on GitHub ↗
(
  scriptPath: string,
  wrapperPath: string,
  cwd: string,
  env: NodeJS.ProcessEnv,
)

Source from the content-addressed store, hash-verified

30}
31
32function writeEnvLaunchScript(
33 scriptPath: string,
34 wrapperPath: string,
35 cwd: string,
36 env: NodeJS.ProcessEnv,
37): void {
38 const exportedVars = Object.entries(env)
39 .filter(([, value]) => value !== undefined)
40 .sort(([left], [right]) => left.localeCompare(right))
41 .map(([key, value]) => `export ${key}=${shellQuote(String(value))}`)
42 .join('\n')
43
44 writeFileSync(
45 scriptPath,
46 [
47 '#!/usr/bin/env bash',
48 'set -euo pipefail',
49 `cd ${shellQuote(cwd)}`,
50 exportedVars,
51 `exec ${shellQuote(wrapperPath)}`,
52 '',
53 ].join('\n'),
54 'utf8',
55 )
56}
57
58function createFixture(options: {
59 readonly prefix: string

Callers 1

createFixtureFunction · 0.85

Calls 2

entriesMethod · 0.80
shellQuoteFunction · 0.70

Tested by

no test coverage detected