commit 0e5e2b3a0fba26c577cf9beebea6d1b19c36d354
parent 29c308bf1eafeb610ea08388676d91f1d02d2dba
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 30 Sep 2023 23:36:50 -0400
haredoc: don't exit early on emit error
Previously, if the call to `emit` errored, the shell would be left in a
weird state, where keypresses weren't properly echoed, and the user
would need to run `reset`. This is now fixed, both for I/O errors, and
for an error parsing HAREDOC_COLORS.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cmd/haredoc/main.ha b/cmd/haredoc/main.ha
@@ -192,14 +192,16 @@ fn doc(name: str, cmd: *getopt::command) (void | error) = {
ctx.out = init_tty(&ctx);
};
- emit(&ctx)?;
+ const ret = emit(&ctx);
- io::close(ctx.out)?;
+ io::close(ctx.out)!;
match (ctx.pager) {
case void => void;
case let proc: exec::process =>
exec::wait(&proc)!;
};
+
+ return ret;
};
// Nearly identical to parse::identstr, except alphanumeric lexical tokens are