mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Fix for stdout race condition in stf doctor
Sometimes the process exits before the data is read from stdout. The result is that the `call` method exits before it has it's output. Example bug: https://github.com/openstf/stf/issues/1091
This commit is contained in:
@@ -30,16 +30,13 @@ module.exports.handler = function() {
|
||||
var proc = cp.spawn(command, args, options)
|
||||
var stdout = []
|
||||
|
||||
proc.stdout.on('readable', function() {
|
||||
var chunk
|
||||
while ((chunk = proc.stdout.read())) {
|
||||
stdout.push(chunk)
|
||||
}
|
||||
proc.stdout.on('data', function(data) {
|
||||
stdout.push(data)
|
||||
})
|
||||
|
||||
proc.on('error', reject)
|
||||
|
||||
proc.on('exit', function(code, signal) {
|
||||
proc.on('close', function(code, signal) {
|
||||
if (signal) {
|
||||
reject(new CheckError('Exited with signal %s', signal))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user