(cmd: string, args: string[], options?: SpawnSyncOptions)
| 7 | * Spawn sync with error handling |
| 8 | */ |
| 9 | export function exec(cmd: string, args: string[], options?: SpawnSyncOptions) { |
| 10 | const proc = spawnSync(cmd, args, options); |
| 11 | |
| 12 | if (proc.error) { |
| 13 | throw proc.error; |
| 14 | } |
| 15 | |
| 16 | if (proc.status !== 0) { |
| 17 | if (proc.stdout || proc.stderr) { |
| 18 | throw new Error(`[Status ${proc.status}] stdout: ${proc.stdout?.toString().trim()}\n\n\nstderr: ${proc.stderr?.toString().trim()}`); |
| 19 | } |
| 20 | throw new Error(`${cmd} exited with status ${proc.status}`); |
| 21 | } |
| 22 | |
| 23 | return proc; |
| 24 | } |
| 25 | |
| 26 | export function bundlingOptionsFromRustFunctionProps(props?: RustFunctionProps): BundlingOptions { |
| 27 | if (props?.bundling?.architecture && props?.architecture && props?.bundling?.architecture !== props?.architecture) { |
no outgoing calls
no test coverage detected