( executable: string, args: string[], cwd?: string, inheritStdio = true, noExit = false )
| 32 | shell.config.verbose = true; |
| 33 | |
| 34 | function 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 | |
| 69 | function yarn( |
| 70 | args: string[], |
no test coverage detected