( command: string, args: string[], options?: SpawnSyncOptions )
| 10 | export const shellOption = process.platform === "win32"; |
| 11 | |
| 12 | export const run = ( |
| 13 | command: string, |
| 14 | args: string[], |
| 15 | options?: SpawnSyncOptions |
| 16 | ) => { |
| 17 | const result = spawnSync(command, args, { |
| 18 | stdio: "inherit", |
| 19 | shell: shellOption, |
| 20 | ...options, |
| 21 | }); |
| 22 | |
| 23 | if (result.error) { |
| 24 | throw result.error; |
| 25 | } |
| 26 | |
| 27 | if (result.status !== 0) { |
| 28 | const stderr = result.stderr?.toString().trim(); |
| 29 | const message = stderr |
| 30 | ? `Command failed: ${command} ${args.join(" ")}\n${stderr}` |
| 31 | : `Command failed with exit code ${result.status}: ${command} ${args.join(" ")}`; |
| 32 | throw new Error(message); |
| 33 | } |
| 34 | |
| 35 | return result; |
| 36 | }; |
| 37 | |
| 38 | export const internalContentDirs = [join(".github", "workflows"), "docs"]; |
| 39 |
no outgoing calls
no test coverage detected