diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:00:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:00:27 -0500 |
commit | cba518546d09e9a716c9230ace1bbadd1c14fc2d (patch) | |
tree | 98bd049ba2f5ec5428331ac2828671128f2ffe82 /src/runner/builtins/mod.rs | |
parent | de77b9e370341fd2fdad06113779ef187a0f5f9d (diff) | |
download | nbsh-cba518546d09e9a716c9230ace1bbadd1c14fc2d.tar.gz nbsh-cba518546d09e9a716c9230ace1bbadd1c14fc2d.zip |
read builtin should return a failure exit code on eof
Diffstat (limited to 'src/runner/builtins/mod.rs')
-rw-r--r-- | src/runner/builtins/mod.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runner/builtins/mod.rs b/src/runner/builtins/mod.rs index dec4dc2..3ae02ea 100644 --- a/src/runner/builtins/mod.rs +++ b/src/runner/builtins/mod.rs @@ -236,7 +236,12 @@ fn read( }; let val = match cfg.io().read_line_stdin().await { - Ok(line) => line, + Ok(line) => { + if line.is_empty() { + return std::process::ExitStatus::from_raw(1 << 8); + } + line + } Err(e) => { bail!(cfg, exe, e); } |