2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-21 04:53:24 +00:00

fix: check if no tty after line read and halt after error

use an empty channel to stop without panicing
This commit is contained in:
sammyette 2024-04-06 18:28:05 -04:00
parent 20761e754c
commit 3a50b45140
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -2,6 +2,7 @@ package main
import (
"bufio"
"errors"
"fmt"
"io"
"os"
@ -9,6 +10,7 @@ import (
"path/filepath"
"runtime"
"strings"
"syscall"
"hilbish/util"
"hilbish/golibs/bait"
@ -189,9 +191,12 @@ input:
} else {
// If we get a completely random error, print
fmt.Fprintln(os.Stderr, err)
if errors.Is(err, syscall.ENOTTY) {
// what are we even doing here?
panic("not a tty")
}
}
// TODO: Halt if any other error occurs
continue
<-make(chan struct{})
}
var priv bool
if strings.HasPrefix(input, " ") {