(
command: string,
args: Array<string>,
options: {
cwd?: string
env?: NodeJS.ProcessEnv
stdio?: `inherit` | `pipe`
} = {},
)
| 29 | const resultsDatabaseName = `tanstack_db_capacitor_e2e_results_${runtimeRunId}` |
| 30 | |
| 31 | function runCommand( |
| 32 | command: string, |
| 33 | args: Array<string>, |
| 34 | options: { |
| 35 | cwd?: string |
| 36 | env?: NodeJS.ProcessEnv |
| 37 | stdio?: `inherit` | `pipe` |
| 38 | } = {}, |
| 39 | ): Promise<string> { |
| 40 | return new Promise((resolvePromise, rejectPromise) => { |
| 41 | let stdout = `` |
| 42 | const child = spawn(command, args, { |
| 43 | cwd: options.cwd ?? packageDirectory, |
| 44 | env: { |
| 45 | ...process.env, |
| 46 | ...options.env, |
| 47 | }, |
| 48 | stdio: |
| 49 | options.stdio === `pipe` ? [`ignore`, `pipe`, `inherit`] : `inherit`, |
| 50 | }) |
| 51 | |
| 52 | if (options.stdio === `pipe`) { |
| 53 | if (!child.stdout) { |
| 54 | rejectPromise(new Error(`${command} did not expose stdout`)) |
| 55 | return |
| 56 | } |
| 57 | |
| 58 | child.stdout.on(`data`, (chunk) => { |
| 59 | stdout += String(chunk) |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | child.on(`exit`, (code) => { |
| 64 | if (code === 0) { |
| 65 | resolvePromise(stdout) |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | rejectPromise( |
| 70 | new Error( |
| 71 | `${command} ${args.join(` `)} exited with code ${String(code)}`, |
| 72 | ), |
| 73 | ) |
| 74 | }) |
| 75 | child.on(`error`, rejectPromise) |
| 76 | }) |
| 77 | } |
| 78 | |
| 79 | function resolveAndroidSdkRoot(): string { |
| 80 | const candidates = [ |
no test coverage detected