mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
Shell: Make redirection errors raise ShellErrors
Naturally, this means that a command with a failing redirection will not start, and so will terminate the pipeline (if any). This also applies to the `exit` run when the shell is closed, fixing a fun bug there as well (thanks to Discord user Salanty for pointing that out) where closing the terminal (i.e. I/O error on the tty) with a failing `exit` command would make the shell retry executing `exit` every time, leading to an eventual stack overflow.
This commit is contained in:
parent
8de8a7766d
commit
783e27f8f9
3 changed files with 79 additions and 77 deletions
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
int run_command(StringView, Optional<SourcePosition> = {});
|
||||
bool is_runnable(StringView);
|
||||
RefPtr<Job> run_command(const AST::Command&);
|
||||
ErrorOr<RefPtr<Job>> run_command(const AST::Command&);
|
||||
NonnullRefPtrVector<Job> run_commands(Vector<AST::Command>&);
|
||||
bool run_file(const String&, bool explicitly_invoked = true);
|
||||
bool run_builtin(const AST::Command&, const NonnullRefPtrVector<AST::Rewiring>&, int& retval);
|
||||
|
@ -234,6 +234,7 @@ public:
|
|||
InvalidSliceContentsError,
|
||||
OpenFailure,
|
||||
OutOfMemory,
|
||||
LaunchError,
|
||||
};
|
||||
|
||||
void raise_error(ShellError kind, String description, Optional<AST::Position> position = {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue