(
command: string,
args: string[],
options: { ignoreReturnCode?: boolean; cwd: string }
)
| 89 | } |
| 90 | |
| 91 | export async function execWithOutput( |
| 92 | command: string, |
| 93 | args: string[], |
| 94 | options: { ignoreReturnCode?: boolean; cwd: string } |
| 95 | ) { |
| 96 | process.stdout.write(`Running: ${command} ${args.join(" ")}` + os.EOL); |
| 97 | let childProcess = spawn(command, args, { |
| 98 | cwd: options.cwd, |
| 99 | }); |
| 100 | childProcess.on("stdout", (data) => process.stdout.write(data)); |
| 101 | childProcess.on("stderr", (data) => process.stderr.write(data)); |
| 102 | let result = await childProcess; |
| 103 | if (!options?.ignoreReturnCode && result.code !== 0) { |
| 104 | throw new Error( |
| 105 | `The command "${command} ${args.join(" ")}" failed with code ${ |
| 106 | result.code |
| 107 | }\n${result.stdout.toString("utf8")}\n${result.stderr.toString("utf8")}` |
| 108 | ); |
| 109 | } |
| 110 | return { |
| 111 | code: result.code, |
| 112 | stdout: result.stdout.toString("utf8"), |
| 113 | stderr: result.stderr.toString("utf8"), |
| 114 | }; |
| 115 | } |
| 116 | |
| 117 | export function sortChangelogEntries( |
| 118 | a: { private: boolean; highestLevel: number }, |
no outgoing calls
no test coverage detected