* Extracts a human-readable error message from an execa result. * * Priority order: * 1. shortMessage - execa's human-readable error (e.g., "Command failed with exit code 1: ...") * This is preferred because it already includes signal info when a process is killed, * making it more inform
( result: ExecaResultWithError, errorCode: number, )
| 71 | * 3. errorCode - fallback to just the numeric exit code |
| 72 | */ |
| 73 | function getErrorMessage( |
| 74 | result: ExecaResultWithError, |
| 75 | errorCode: number, |
| 76 | ): string { |
| 77 | if (result.shortMessage) { |
| 78 | return result.shortMessage |
| 79 | } |
| 80 | if (typeof result.signal === 'string') { |
| 81 | return result.signal |
| 82 | } |
| 83 | return String(errorCode) |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * execFile, but always resolves (never throws) |
no outgoing calls
no test coverage detected