summaryrefslogtreecommitdiff
path: root/Shell
AgeCommit message (Collapse)Author
2020-08-06LibLine+Shell: Remove unused split_mechanismNico Weber
It was only read in should_break_token(), which had no callers. should_break_token() also got `foo\\ bar` and `"foo bar"` wrong.
2020-08-06Shell: Make "fg" set the TTY PGID before SIGCONT'ing the jobAndreas Kling
Otherwise the child will get SIGTTIN/SIGTTOU on next TTY I/O.
2020-08-06Shell: Print job status after suspending a commandAndreas Kling
2020-08-06Shell: Move printing job status into a Job::print_status() helperAndreas Kling
This is only used by the "jobs" builtin right now, but more soon.
2020-08-06Shell: Remove unnecessary ignore() in Shell::custom_event()Andreas Kling
Ignoring an event means that it will bubble to the parent Core::Object. This is not necessary here.
2020-08-06Shell: Store jobs as NonnullRefPtr<Job>Andreas Kling
2020-08-06Shell: Make Job constructors private and use a create() helperAndreas Kling
Also store PGIDs as pid_t since that's what they are.
2020-08-06Shell: Make run_command() return a NonnullRefPtrVector<Job>Andreas Kling
This never returns null Job pointers.
2020-08-06Shell: Mark suspended children as such when receiving a SIGCHLDAnotherTest
2020-08-05Shell: Do not assume that stdin/stdout is a TTYAnotherTest
This closes #2989.
2020-08-04Shell: Give the TTY to the foreground processAnotherTest
This fixes the bug with the shell not waiting for any foreground process that attempts to read from the terminal in the Lagom build.
2020-08-04Shell: Use NonnullRefPtr to simplify some things in the parser/ASTAndreas Kling
2020-08-04Shell: Correct FdRedirection inheriting from two RefCounted basesAnotherTest
Also add missing calls to `adopt()`.
2020-08-04Shell: Add support for ARGV (and $*, $#)AnotherTest
This patchset also adds the 'shift' builtin, as well as the usual tests. closes #2948.
2020-08-04Shell: factor out updating the path cache into a function.Mathieu PATUREL
2020-08-04Shell: update cached_path when adding aliasesMathieu PATUREL
This has the nice side effect of fixing alias completion, because cached_path is the source of truth for the completion system, and it was only refreshed (with shell::cache_path()) in the shell's constructor, before the rc files where loaded (ie no aliases) This also means that shell::is_runnable can now rely on the cache, and doesn't have to check the aliases itself.
2020-08-04Shell: highlight runnable commandsMathieu PATUREL
And display in red the command which will result in something like "no command, or is directory" (inspired by the fish shell).
2020-07-30Shell: Tweak tests to use 'echo -n' when newlines are significantAnotherTest
2020-07-30Shell: Add tests for '&&' and '||' parsing and evaluationAnotherTest
2020-07-30Shell: Fix parse mistake in '&&' not being recursiveAnotherTest
2020-07-30Shell: Do not assume that wstatus is valid after wait() returns 0AnotherTest
According to the linux waitid manpage, the value of wstatus is unspecified if wait() returns 0, so we should not assume that any value it holds is correct (including the exit code). This is only applicable to the Lagom build.
2020-07-27Shell: Ignore leading semicolonsAnotherTest
This makes things like `foo&; bar` behave as expected. Such behaviour is actually closer to the grammar defined in Parser.h anyway :P
2020-07-26Refactor: Change the AK::binary_search signature to use AK::Span.asynts
2020-07-25Shell: Don't crash when autocompleting a non-bare wordBen Wiederhake
For example, type 'Hello?' without the quotation marks but with the question mark, and press TAB. Previously, this would crash the Shell. Now, it merely refuses to make any suggestions. We could do better, but that is too hard for now.
2020-07-17Shell: Mark ForLoop as would_executeAnotherTest
This fixes #2825.
2020-07-16Shell: Add a test for loopsAnotherTest
2020-07-16Shell: Add a 'for' loopAnotherTest
Closes #2760. This commit adds a 'for' loop, and tweaks the syntax slightly to make && bind more tightly than || (allowing for `expr && if_ok || if_bad`) :^)
2020-07-16Shell: Parse lists serially, and flatten them only when neededAnotherTest
This allows `((1 2 3) (4 5 6))` to remain nested until we explicitly flatten it out.
2020-07-16Shell: Remove '[' and ']' as special shell charactersPeter Elliott
This makes the test utility work, when invoked as '['
2020-07-15Shell: Explicitly declare 'environ' to make the macOS Lagom build happyAnotherTest
2020-07-13Shell: Avoid waiting for jobs that were *just* unblockedAnotherTest
This fixes the issue with C-z not suspending the job on the first try. ...and further signal issues when the suspended job is contiued.
2020-07-13Shell: Put children in their own process groups and fix job controlAnotherTest
This commit fixes job control by putting children in their own process group, and proxying TTY signals to active jobs. This also cleans up the code around builtin_disown a bit to use the newer job interfaces.
2020-07-13Shell: Resolve aliases in builtin_timeAnotherTest
2020-07-13Shell: Move out run_commands and expand_aliases to be Shell member fnsAnotherTest
This makes running commands from outside the AST chain easier.
2020-07-12Shell: Recursively resolve aliasesAnotherTest
2020-07-09Shell: Pledge sigactionTom
The shell is wiring up signal handlers, and when they get torn down by Core::EventLoop, they are reset, which requires sigaction.
2020-07-09Shell: Handle signals asynchronouslyTom
Fixes #2717
2020-07-07Shell: Suggest aliases when completing program names :^)AnotherTest
Closes #2732
2020-07-07Shell: Skip creating a Join node when nothing was parsedAnotherTest
This fixes a crash when Shell tries to highlight `|`.
2020-07-07Shell: Run both /etc/shellrc and ~/.shellrc on startupAndreas Kling
The global script runs before the local (per-user) one.
2020-07-06Shell: Keep the TTY on the same pgroup to get tty signalsAnotherTest
This allows the shell to be notified about SIGWINCH even when a child process is running in the foreground.
2020-07-06Shell: Handle the case where the child we're waiting for doesn't existAnotherTest
Normally, this should not happen, as the child should stay around until we do a waitid on it.
2020-07-06Shell: Do not treat the ending newline as part of a commentAnotherTest
This allows the parser to finally parse the entire source into a single AST. As a result of allowing comments inside sequences, Sequence is also marked as would_execute if its left or right node would.
2020-07-06Shell: Do not treat the absence of an init script as an errorAnotherTest
2020-07-05Shell: Do not remove more than 2 dashes from the option being completedAnotherTest
This makes '------inl' a completion request for an option named '----inl' instead of 'inl'.
2020-07-05Shell: Add some testsAnotherTest
2020-07-05Shell: Initial support for 'option' completionsAnotherTest
Take one small step towards #2357. Handle completing barewords starting with '-' by piping the requests to the Shell::complete_option(program_name, option) :^) Also implements completion for a single builtin (setopt) until we figure out how to handle #2357.
2020-07-05Shell: Add a 'setopt' builtinAnotherTest
This builtin sets (and unsets) boolean flags that alter the behaviour of the shell. The only flags added are - inline_exec_keep_empty_segments: Keep empty segments in the result of splitting $(...) by $IFS - verbose: Announce each command before executing it It should be noted that the (rather extreme) verbosity of the names is intentional, and will hopefully be alleviated by the next commit :^)
2020-07-05Shell: Show descriptions about syntax errorsAnotherTest
The description contains an error message and where in the source the error happened.
2020-07-05Shell: Allow a command sequence to be delimited by newlinesAnotherTest