MCPcopy Create free account
hub / github.com/babel/babel / exec

Function exec

Makefile.source.ts:34–67  ·  view source on GitHub ↗
(
  executable: string,
  args: string[],
  cwd?: string,
  inheritStdio = true,
  noExit = false
)

Source from the content-addressed store, hash-verified

32shell.config.verbose = true;
33
34function exec(
35 executable: string,
36 args: string[],
37 cwd?: string,
38 inheritStdio = true,
39 noExit = false
40): string {
41 console.log(
42 `${executable
43 .replaceAll(YARN_PATH, "yarn")
44 .replaceAll(NODE_PATH, "node")} ${args.join(" ")}`
45 );
46
47 try {
48 return execaSync(executable, args, {
49 stdio: inheritStdio ? "inherit" : undefined,
50 cwd: cwd && path.resolve(cwd),
51 env: process.env,
52 }).stdout!;
53 } catch (error: any) {
54 if (inheritStdio && error.exitCode !== 0) {
55 console.error(
56 new Error(
57 `\ncommand: ${executable} ${args.join(" ")}\ncode: ${error.exitCode}`
58 )
59 );
60 if (!noExit) {
61 // eslint-disable-next-line n/no-process-exit
62 process.exit(error.exitCode);
63 }
64 }
65 throw error;
66 }
67}
68
69function yarn(
70 args: string[],

Callers 4

yarnFunction · 0.85
nodeFunction · 0.85
bootstrapParserTestsFunction · 0.85
Makefile.source.tsFile · 0.85

Calls 1

exitMethod · 0.45

Tested by

no test coverage detected