Skip to content
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

Change wording of EOF behaviour in stage_1 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helpers/harness.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,6 @@ while {![eof $test_file]} {
}

# Calling close causes zsh to exit unhappily, so we send ^D instead.
puts "Sending ^D to shell to exit"
send -s "\x04"
if {0 != [wait_for_exit]} {error "shell didn't exit cleanly"}
5 changes: 5 additions & 0 deletions helpers/timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ static void kill_em_all(int _)
{
(void)_;
kill(pid, SIGTERM);
// In general, it's a Very Bad Idea to printf inside of a signal handler.
// However, since we're immediatly exiting, it is acceptable in this case.
// See https://www.securecoding.cert.org/confluence/display/c/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers
// for more information on what isn't safe to do in signal handlers.
printf("Killing process %d due to timeout\n", pid);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion stage_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You should
itself instead of executing an external program), call it;
otherwise
- execute that as a command with space-delimited arguments;
- repeat until you receive EOF on `stdin`.
- when you receive EOF on `stdin` instead of a command, exit.

### Executing a command

Expand Down