| 156 | } |
| 157 | |
| 158 | export async function runReactDevtoolsCommand( |
| 159 | args: string[], |
| 160 | options: ReactDevtoolsCommandOptions = {}, |
| 161 | ): Promise<number> { |
| 162 | const cwd = options.cwd ?? process.cwd(); |
| 163 | const env = options.env ?? process.env; |
| 164 | const exitCode = await withRemoteDevtoolsCompanion(args, options, async () => { |
| 165 | const result = await runCmdStreaming('npm', buildReactDevtoolsNpmExecArgs(args), { |
| 166 | cwd, |
| 167 | env, |
| 168 | allowFailure: true, |
| 169 | onStdoutChunk: (chunk) => { |
| 170 | process.stdout.write(chunk); |
| 171 | }, |
| 172 | onStderrChunk: (chunk) => { |
| 173 | process.stderr.write(chunk); |
| 174 | }, |
| 175 | }); |
| 176 | return result.exitCode; |
| 177 | }); |
| 178 | maybePrintRemoteIosWaitHint(args, options.flags, exitCode); |
| 179 | return exitCode; |
| 180 | } |