MCPcopy Create free account
hub / github.com/TanStack/db / runCommand

Function runCommand

packages/capacitor-db-sqlite-persistence/e2e/run-ios-e2e.ts:29–61  ·  view source on GitHub ↗
(
  command: string,
  args: Array<string>,
  options: {
    cwd?: string
    env?: NodeJS.ProcessEnv
  } = {},
)

Source from the content-addressed store, hash-verified

27const resultsDatabaseName = `tanstack_db_capacitor_e2e_results_${runtimeRunId}`
28
29function runCommand(
30 command: string,
31 args: Array<string>,
32 options: {
33 cwd?: string
34 env?: NodeJS.ProcessEnv
35 } = {},
36): Promise<void> {
37 return new Promise((resolvePromise, rejectPromise) => {
38 const child = spawn(command, args, {
39 cwd: options.cwd ?? packageDirectory,
40 env: {
41 ...process.env,
42 ...options.env,
43 },
44 stdio: `inherit`,
45 })
46
47 child.on(`exit`, (code) => {
48 if (code === 0) {
49 resolvePromise()
50 return
51 }
52
53 rejectPromise(
54 new Error(
55 `${command} ${args.join(` `)} exited with code ${String(code)}`,
56 ),
57 )
58 })
59 child.on(`error`, rejectPromise)
60 })
61}
62
63async function resolveSimulatorId(): Promise<string> {
64 const requestedId = process.env.TANSTACK_DB_CAPACITOR_IOS_SIMULATOR_ID?.trim()

Callers 2

ensureNativeProjectFunction · 0.70
waitForResultFunction · 0.70

Calls 2

onMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected