diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2023-06-23 17:31:07 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2023-06-23 17:44:35 -0400 |
| commit | fbd5b48ebbca847dacf37cca1a5661dd52e4780d (patch) | |
| tree | 6efe4ad37a237f02af90cb8d477c630fdc1b6d13 | |
| parent | a334ae5457bce2f3a9b15ef02c4d4998cfcfa457 (diff) | |
Exit with an error if stdin is not interactive
| -rw-r--r-- | main.ha | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -53,6 +53,10 @@ export fn main() void = { os::exit(1); }; + if (!tty::isatty(os::stdin_file)) { + fmt::fatal("Error: stdin is not a tty"); + }; + let path = cmd.args[0]; let mode = os::stat(path)!.mode; if (mode & fs::mode::DIR != 0) { |
