Function
runJson
(
command: string,
args: string[],
options: { cwd?: string } = {},
)
Source from the content-addressed store, hash-verified
| 878 | } |
| 879 | |
| 880 | function runJson<T>( |
| 881 | command: string, |
| 882 | args: string[], |
| 883 | options: { cwd?: string } = {}, |
| 884 | ): T { |
| 885 | const result = spawnSync(command, args, { |
| 886 | cwd: options.cwd, |
| 887 | encoding: "utf8", |
| 888 | maxBuffer: 1024 * 1024, |
| 889 | }); |
| 890 | if (result.status !== 0) { |
| 891 | throw new Error( |
| 892 | result.stderr.trim() || `${command} ${args.join(" ")} failed`, |
| 893 | ); |
| 894 | } |
| 895 | return JSON.parse(result.stdout) as T; |
| 896 | } |
| 897 | |
| 898 | function requestOk( |
| 899 | endpoint: string, |
Tested by
no test coverage detected