Add full support for reading from stdin

Previosuly when reading from stdin we did not redirect back to the real
stdin afterwards so it was imposible to interact with y/n questions.

Now redirect back to "/dev/tty" just like pacman does.
This commit is contained in:
morganamilo committed 2018-03-12 00:04:50 +00:00
1 parent f1aff7908d
commit b0961e866d
1 file changed
+10
+10
View File
@@ -560,11 +560,21 @@ func (parser *arguments) parseCommandLine() (err error) {
}
if cmdArgs.existsArg("-") {
var file *os.File
err = cmdArgs.parseStdin()
cmdArgs.delArg("-")
if err != nil {
return
}
file, err = os.Open("/dev/tty")
if err != nil {
return
}
os.Stdin = file
}
return