(command: string)
| 313 | } |
| 314 | |
| 315 | function runShellCommand(command: string): Promise<CommandResult> { |
| 316 | return new Promise(resolve => { |
| 317 | const proc = spawn(command, [], { |
| 318 | stdio: ['pipe', 'pipe', 'pipe'], |
| 319 | shell: true, |
| 320 | }); |
| 321 | |
| 322 | let stdout = ''; |
| 323 | let stderr = ''; |
| 324 | |
| 325 | proc.stdout?.on('data', (data: Buffer) => { |
| 326 | stdout += data.toString(); |
| 327 | }); |
| 328 | |
| 329 | proc.stderr?.on('data', (data: Buffer) => { |
| 330 | stderr += data.toString(); |
| 331 | }); |
| 332 | |
| 333 | proc.on('close', (code: number | null) => { |
| 334 | resolve({stdout, stderr, code: code ?? 0}); |
| 335 | }); |
| 336 | |
| 337 | proc.on('error', (err: Error) => { |
| 338 | resolve({stdout, stderr: err.message, code: 1}); |
| 339 | }); |
| 340 | }); |
| 341 | } |
| 342 | |
| 343 | export async function isPlaywrightReady(): Promise<boolean> { |
| 344 | try { |
no test coverage detected