Skip to content

Commit

Permalink
Wait with input when saving with sudo and error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
niten94 committed Dec 16, 2024
1 parent 4607b3b commit 755e03f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/buffer/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func overwriteFile(name string, enc encoding.Encoding, fn func(io.Writer) error,

args = append(args, writeCommand(name)...)
cmd = exec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if writeCloser, err = cmd.StdinPipe(); err != nil {
return
Expand Down Expand Up @@ -91,6 +93,9 @@ func overwriteFile(name string, enc encoding.Encoding, fn func(io.Writer) error,
if withSudo {
// wait for dd to finish and restart the screen if we used sudo
err := cmd.Wait()
if err != nil {
screen.TermMessage("")
}
screen.TempStart(screenb)

signal.Notify(util.Sigterm, os.Interrupt)
Expand Down

0 comments on commit 755e03f

Please sign in to comment.