MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / run

Function run

tooling/scripts/run-go-server-test.mjs:12–32  ·  view source on GitHub ↗
(command, args, cwd = repoRoot, options = {})

Source from the content-addressed store, hash-verified

10const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
11
12function run(command, args, cwd = repoRoot, options = {}) {
13 const shell = options.shell ?? false
14 return new Promise((resolvePromise, rejectPromise) => {
15 const child = spawn(command, args, {
16 cwd,
17 env: options.env ?? process.env,
18 stdio: 'inherit',
19 shell,
20 })
21
22 child.on('exit', (code) => {
23 if (code === 0) {
24 resolvePromise()
25 return
26 }
27 rejectPromise(new Error(`${command} ${args.join(' ')} exited with code ${code ?? 'unknown'}`))
28 })
29
30 child.on('error', rejectPromise)
31 })
32}
33
34await run(npmCommand, ['run', 'prepare-web'], serverRoot, {
35 shell: process.platform === 'win32',

Callers 1

Calls 1

onMethod · 0.45

Tested by

no test coverage detected