MCPcopy Index your code
hub / github.com/cameri/nostream / runPnpmCli

Function runPnpmCli

test/unit/cli/cli.integration.spec.ts:48–79  ·  view source on GitHub ↗
(args: string[], env: NodeJS.ProcessEnv = {})

Source from the content-addressed store, hash-verified

46}
47
48const runPnpmCli = (args: string[], env: NodeJS.ProcessEnv = {}): Promise<CliResult> => {
49 return new Promise((resolve, reject) => {
50 const child = spawn('pnpm', ['run', 'cli', ...args], {
51 cwd: projectRoot,
52 env: {
53 ...process.env,
54 ...env,
55 },
56 stdio: 'pipe',
57 })
58
59 let stdout = ''
60 let stderr = ''
61
62 child.stdout.on('data', (chunk) => {
63 stdout += chunk.toString()
64 })
65
66 child.stderr.on('data', (chunk) => {
67 stderr += chunk.toString()
68 })
69
70 child.on('error', reject)
71 child.on('close', (code) => {
72 resolve({
73 code: code ?? 1,
74 stdout,
75 stderr,
76 })
77 })
78 })
79}
80
81const createShimCommand = (dir: string, name: string, scriptBody: string) => {
82 const target = path.join(dir, name)

Callers 1

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected