summaryrefslogtreecommitdiff
path: root/Shell/main.cpp
AgeCommit message (Collapse)Author
2020-12-08Shell: Replace all dbg()'s with dbgln()AnotherTest
2020-12-08Shell: Make <return> go to a new line when the command is incompleteAnotherTest
"incomplete" meaning that it has a syntax error that can be recovered from by continuing the input.
2020-10-26Shell+LibLine: Move Shell::{load,save}_history() to Line::EditorLinus Groh
This allows us to easily re-use history loading and saving in other programs using Line::Editor, as well as implementing universally recognized HISTCONTROL.
2020-10-13Style: Remove uses of NULL, substituting nullptrMatthew L. Curry
2020-10-04Shell: Move everything to the Shell namespaceAnotherTest
Also provide a basic default-constructor.
2020-10-04AK: Don't add newline for outf/dbgf/warnf.asynts
In the future all (normal) output should be written by any of the following functions: out (currently called new_out) outln dbg (currently called new_dbg) dbgln warn (currently called new_warn) warnln However, there are still a ton of uses of the old out/warn/dbg in the code base so the new functions are called new_out/new_warn/new_dbg. I am going to rename them as soon as all the other usages are gone (this might take a while.) I also added raw_out/raw_dbg/raw_warn which don't do any escaping, this should be useful if no formatting is required and if the input contains tons of curly braces. (I am not entirely sure if this function will stay, but I am adding it for now.)
2020-10-03Shell: Fix badly worded help string for '--format'AnotherTest
2020-10-01Shell: Wait for *any* child to change state when receiving a SIGCHLDAnotherTest
This really just works around the core issue, which is that we have no reliable way to know exactly who raised the signal (yet). Fixes #3645, in a very weird (yet apparently standard) way.
2020-10-01Shell: Sneak a way into being a session leaderAnotherTest
2020-09-30Shell: Make 'editor' a member of Shell, and provide a LibShellAnotherTest
2020-09-26Shell: Add live formatting and take an option to enable itAnotherTest
This patchset makes it possible for the shell to format the current buffer of the line editor live, with somewhat accurate cursor tracking. Since this feature is pretty goofy at best, let's keep it off by default for now :^)
2020-09-26Shell: Add a (very basic) formatterAnotherTest
2020-09-19Shell: Make a new session at start if there's no active sessionAnotherTest
2020-09-14Shell: Add support for $0,$1,...AnotherTest
2020-09-09Shell: Fix event loop processing and backgrounding in subshellsAnotherTest
2020-08-21LibLine: Handle interrupts/window size changes internallyAnotherTest
2020-08-21LibLine: Handle Ctrl-C and Ctrl-D in a way similar to other line editorsAnotherTest
Makes C-c print "^C" and continue prompting on a new line. Also fixes a problem where an interrupted get_line() would need more read()'s than required to update the display.
2020-08-18LibLine: Read configuration from a config fileAnotherTest
2020-08-15Shell: Allow redirections and pipes on builtinsAnotherTest
Fixes #3072.
2020-08-09Shell: Stop a for loop upon receiving two consecutive interruptionsAnotherTest
This does not work perfectly (just like every other shell...), if the running program handles the signal (SIGINT in this case) and quits cleanly, the shell cannot detect the interruption. This is the case with our `sleep(1)`.
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: Store jobs as NonnullRefPtr<Job>Andreas Kling
2020-08-06Shell: Mark suspended children as such when receiving a SIGCHLDAnotherTest
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: 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-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-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-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: 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 absence of an init script as an errorAnotherTest
2020-07-05Shell: Build as part of Lagom as wellAnotherTest
Bringing the Serenity Shell to your very own host system :^)
2020-07-05Shell: Read and evaluate an init file on startAnotherTest
This behaviour is overridable with the `--skip-init' flag. The default file is at '~/shell-init.sh'
2020-07-05Shell: Use ArgsParser for argument parsingAnotherTest
2020-07-05Shell: Switch to a new parser and ASTAnotherTest
This commit also completely reworks the execution, highlighting and completion model to work with the new AST. New additions: - $(...) stdout captures - fd>&fd redirections - fd>&- redirections (close fd) - read-write redirections (<> path) - completely event-based execution - the weird idea of allowing the user to redirect the shell's own fds - variables in strings - local variables - minimal list support - adding hyperlinks to all paths that exist
2020-06-01LibLine: Handle interrupts againAnotherTest
This commit makes LibLine handle interrupts (as reported via interrupted() and resized()) again. There is a little catch with the shell: ``` $ ls | pipe> <C-c> (prompt stays here until a key is pressed) ```
2020-05-27Shell: Avoid messing with sigaction while waiting for a childAnotherTest
2020-05-27LibLine: Use Core::EventLoop for outer read loopAnotherTest
This commit changes LibLine's internal structure to work in an event loop, and as a result, also switches it to being a Core::Object.
2020-05-26Userland et al: Pledge sigaction when neededSergey Bugaev
* In some cases, we can first call sigaction()/signal(), then *not* pledge sigaction. * In other cases, we pledge sigaction at first, call sigaction()/signal() second, then pledge again, this time without sigaction. * In yet other cases, we keep the sigaction pledge. I suppose these could all be migrated to drop it or not pledge it at all, if somebody is interested in doing that.
2020-05-25Shell: Refuse to be suspended with ^ZAnotherTest
Suspending the shell while interacting with it is pretty weird, so let's just disallow this behaviour.
2020-05-20LibLine: Unify completion hooks and adapt its usersAnotherTest
LibLine should ultimately not care about what a "token" means in the context of its user, so force the user to split the buffer itself. This also allows the users to pick up contextual clues as well, since they have to lex the line themselves. This commit pacthes Shell and the JS repl to better handle completions, so certain wrong behaviours are now corrected as well: - JS repl can now complete "Object . getOw<tab>" - Shell can now complete "echo | ca<tab>" and paths inside strings
2020-05-17Shell: Switch to using Core::EventLoopAnotherTest
This commit refactors Shell to a Core::Object and switches its looping to Core::EventLoop.
2020-05-17Shell: Patch most of the builtins to use Core::ArgsParserAnotherTest
The remaining one is 'pushd', which seems to have relatively complex logic with regards to its arguments.
2020-05-17Shell: Add job control capabilitiesAnotherTest
This patchset adds the `jobs`, `fg` and `bg` builtins.
2020-05-16Shell: Properly handle parser syntax errorsLinus Groh
In the case of a syntax error the shell parser prints an error message to stderr and returns an empty Vector<Command> - in that case we shouldn't try to determine whether or not we can continue parsing but abort immediately - is_complete() expects that *something* was parsed successfully. Fixes #2251.
2020-05-16Shell: Use DirIterator::SkipParentAndBaseDirShannon Booth