Merge pull request #2193 from milkwine/fix-readSync

fix readSync
This commit is contained in:
Mrunal Patel 2020-03-24 14:29:42 -07:00 committed by GitHub
commit be51398a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -47,20 +47,21 @@ func readSync(pipe io.Reader, expected syncType) error {
if err == io.EOF {
return fmt.Errorf("parent closed synchronisation channel")
}
return fmt.Errorf("failed reading error from parent: %v", err)
}
if procSync.Type == procError {
var ierr genericError
if procSync.Type == procError {
var ierr genericError
if err := json.NewDecoder(pipe).Decode(&ierr); err != nil {
return fmt.Errorf("failed reading error from parent: %v", err)
}
return &ierr
if err := json.NewDecoder(pipe).Decode(&ierr); err != nil {
return fmt.Errorf("failed reading error from parent: %v", err)
}
if procSync.Type != expected {
return fmt.Errorf("invalid synchronisation flag from parent")
}
return &ierr
}
if procSync.Type != expected {
return fmt.Errorf("invalid synchronisation flag from parent")
}
return nil
}