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 2018-03-12 00:04:50 +00:00
parent f1aff7908d
commit b0961e866d
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E

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