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

Implement way to test use of ^C in shell courses #39

Open
filipsch opened this issue May 24, 2018 · 1 comment
Open

Implement way to test use of ^C in shell courses #39

filipsch opened this issue May 24, 2018 · 1 comment

Comments

@filipsch
Copy link
Contributor

@gvwilson commented on Thu May 17 2018

From datacamp-content/courses-introduction-to-shell#131: if the user types cat > output.txt instead of cat input.txt > output.txt, the command hangs up waiting for user input. We ask them to do something like this at one point in order to teach them how to use ^C to stop programs, but their ^C isn't passed to the SCT, so we have no way to check if they used it or not.

@machow
Copy link
Contributor

machow commented May 25, 2018

From glancing at the exercise, which is titled "How can I stop a running program?", it seems like one alternative is that the exercise starts a running program in the PEC. Then, any student that stops it (causing the SCT to run) has successfully stopped a running program.

In bash specific language, it sounds like this question is asking how to tell a student has sent the SIGINT signal. So if that's the goal, then running a program that only closes for SIGINT seems like it would do it.

If you really didn't want to run a program in PEC, you could run PEC to trap SIGINT:

https://stackoverflow.com/questions/15785522/catch-sigint-in-bash-handle-and-ignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants