ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

commit 7554e0697e3a3a3f794451f717389c21a3b2c50f
parent 3e90e0b57bcefb6a268efe96367d195d11da2977
Author: Byron Torres <b@torresjrjr.com>
Date:   Mon,  8 Jan 2024 18:48:32 +0000

WIP: import os::exec::error bug

Diffstat:
Mcommand.ha | 7++++---
Mmain.ha | 2++
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/command.ha b/command.ha @@ -41,6 +41,7 @@ type CmdError = !( | InvalidGlobalSubCmd | regex::error | fs::error + | os::exec::error ); type UnexpectedAddress = !void; @@ -455,12 +456,12 @@ fn cmd_read(s: *Session, cmd: *Command) (void | Error) = { // TODO: handle '!'s let shcmd = exec::cmd( "sh", "-c", strings::cut(cmd.arg1, "!").1 - )!; + )?; let pipe = exec::pipe(); exec::addfile(&shcmd, os::stdout_file, pipe.1); - let proc = exec::start(&shcmd)!; + let proc = exec::start(&shcmd)?; io::close(pipe.1)!; - exec::wait(&proc)!; + exec::wait(&proc)?; yield pipe.0; }; defer io::close(h)!; diff --git a/main.ha b/main.ha @@ -169,6 +169,8 @@ fn strerror(err: Error) str = { return regex::strerror(e); case let e: fs::error => return fs::strerror(e); + case let e: os::exec::error => + return os::exec::strerror(e); // ParseError case let e: UnknownCommand => return "Unknown command"; // TODO: append 'e'?