-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve shell #43
Merged
Merged
Improve shell #43
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Redirections have the form [[2|&]> <file>]. Supported redirection are: * '>': redirecting stdout * '2>': redirecting stderr * '&>': redirecting stdout and stderr Only one redirection is allowed and it must follow the command the behavior otherwise is undefined.
Our signal handler for SIGCHLD may run any time reaping any terminated child processes. It even may reap processes the main loop is explicitly waiting for. This may cause the status of some processes not being reported properly. Imagine simply calling a non-exiting binary. The forked child will exit with status 1 after execvp failed. The signal handler of the shell may run before the specific "blocking" waitpid call is reached, reaping the child and dropping its exit status. In order to prevent this race, we block SIGCHLD before forking. We immediately enable it again in the forked child. In the shell however, the signal is unblocked after we have waited for the child or immediately if we are not blocking.
This is more in line with what other shells actually do.
Additionally, add a simple man page mentioning the new behavior.
Extract the command completion logic from the __cmd_get loop into a separate function.
__cmd_clr() already resets the cursor to 0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a collection of all the shell patches I collected.
It included bugfixes next to new features, like redirects using
dup
or support for executing commands from files.If the changes are too big let me know an I will break them into smaller pieces.