MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / run

Function run

scripts/gclient-sync.ts:71–90  ·  view source on GitHub ↗
(
  command: string,
  args: string[],
  {cwd, env, shell}: RunOptions,
)

Source from the content-addressed store, hash-verified

69}
70
71function run(
72 command: string,
73 args: string[],
74 {cwd, env, shell}: RunOptions,
75): void {
76 const commandLine = [command, ...args].join(' ');
77 console.log(`> ${commandLine} (in ${cwd})`);
78 const result = shell
79 ? spawnSync(commandLine, {cwd, env, stdio: 'inherit', shell: true})
80 : spawnSync(command, args, {cwd, env, stdio: 'inherit'});
81 if (result.error) {
82 throw new Error(
83 `Failed to start "${commandLine}" in ${cwd}: ${result.error.message}`,
84 );
85 }
86 if (result.status !== 0) {
87 const exit = result.status ?? result.signal;
88 throw new Error(`"${commandLine}" in ${cwd} exited with ${exit}`);
89 }
90}
91
92// depot_tools uses `.bat` launchers on Windows, which only a shell can run.
93// Callers pass fixed arguments without spaces, so joining them is safe.

Callers 2

runDepotToolFunction · 0.70
gclient-sync.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected