(args: string[], opts?: { cwd?: string; input?: string })
| 126 | |
| 127 | /** Run a command with an argument array — bypasses the shell entirely */ |
| 128 | export function runArgs(args: string[], opts?: { cwd?: string; input?: string }): string { |
| 129 | const result = checkIntercept(args, opts); |
| 130 | if (result?.intercepted) { |
| 131 | if ('error' in result) throw new Error(result.error); |
| 132 | return result.result; |
| 133 | } |
| 134 | const [cmd, ...rest] = args; |
| 135 | return execFileSync(cmd!, rest, { |
| 136 | cwd: opts?.cwd, |
| 137 | input: opts?.input, |
| 138 | encoding: 'utf-8', |
| 139 | stdio: [opts?.input ? 'pipe' : 'pipe', 'pipe', 'pipe'], |
| 140 | }).trim(); |
| 141 | } |
| 142 | |
| 143 | /** Async version of runArgs */ |
| 144 | export function runArgsAsync(args: string[], opts?: { cwd?: string; input?: string }): Promise<string> { |
no test coverage detected
searching dependent graphs…