diff --git a/pkg/tools/shell.go b/pkg/tools/shell.go index 7e5f6489..873d4fcb 100644 --- a/pkg/tools/shell.go +++ b/pkg/tools/shell.go @@ -696,11 +696,11 @@ func (t *ExecTool) runBackground(ctx context.Context, command, cwd string, ptyEn } } - // All pipes closed, get exit status - if stdinWriter != nil { - _ = stdinWriter.Close() - } - cmd.Wait() + // All pipes closed, get exit status + if stdinWriter != nil { + _ = stdinWriter.Close() + } + cmd.Wait() session.mu.Lock() if cmd.ProcessState != nil { diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go index b6cdc183..b50740ac 100644 --- a/pkg/updater/updater.go +++ b/pkg/updater/updater.go @@ -574,19 +574,19 @@ func extractZip(archivePath, destDir string) error { if err != nil { return err } - out, err := os.OpenFile(target, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, f.FileInfo().Mode()) - if err != nil { - _ = rc.Close() - return err - } - if _, err := io.Copy(out, rc); err != nil { - _ = rc.Close() - _ = out.Close() - return err - } - if err := rc.Close(); err != nil { - _ = out.Close() - return fmt.Errorf("close zip entry reader: %w", err) + out, err := os.OpenFile(target, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, f.FileInfo().Mode()) + if err != nil { + _ = rc.Close() + return err + } + if _, err := io.Copy(out, rc); err != nil { + _ = rc.Close() + _ = out.Close() + return err + } + if err := rc.Close(); err != nil { + _ = out.Close() + return fmt.Errorf("close zip entry reader: %w", err) } if err := out.Close(); err != nil { return fmt.Errorf("close extracted file %q: %w", target, err)