Merge pull request #5 from ebetica/piped_incorrect

Fix bug for when no input is piped but -q is used
This commit is contained in:
Tony Worm 2023-05-03 18:01:41 -04:00 committed by GitHub
commit 1a77595a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,7 +168,9 @@ func main() {
// no args, or interactive... read from stdin // no args, or interactive... read from stdin
// this is mainly for replacing text in vim // this is mainly for replacing text in vim
if len(args) == 0 && !PromptMode { fi, _ := os.Stdin.Stat()
inputIsFromPipe = (fi.Mode() & os.ModeCharDevice) == 0
if len(args) == 0 && !PromptMode && inputIsFromPipe {
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
var buf bytes.Buffer var buf bytes.Buffer
for { for {