(data)
| 42 | } |
| 43 | |
| 44 | function handleStderr(data) { |
| 45 | const message = data.toString() |
| 46 | if (failRegexp && failRegexp.test(message)) { |
| 47 | instance.kill() |
| 48 | return reject(new Error("received failRegexp")) |
| 49 | } |
| 50 | process.stderr.write(message) |
| 51 | |
| 52 | if (opts && opts.onStderr) { |
| 53 | opts.onStderr(message.toString()) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | instance.stdout?.on("data", handleStdout) |
| 58 | instance.stderr?.on("data", handleStderr) |