Migrate a test from C++ to littlecheck

This eliminates noisy warnings about tcsetpgrp when the tests are run
without a tty, as reported in #6539
This commit is contained in:
ridiculousfish 2020-01-26 20:46:47 -08:00
parent ae77f1b163
commit 7a2a6d76f3
2 changed files with 14 additions and 12 deletions

View File

@ -1065,18 +1065,6 @@ static void test_cancellation() {
test_1_cancellation(L"while true ; echo nothing > /dev/null; end");
test_1_cancellation(L"for i in (while true ; end) ; end");
// Ensure that if child processes SIGINT, we exit our loops
// Test for #3780
// Ugly hack - temporarily fake an interactive session
// else we will SIGINT ourselves in response to our child death
session_interactivity_t iis = session_interactivity();
set_interactive_session(session_interactivity_t::implied);
const wchar_t *child_self_destructor = L"while true ; sh -c 'sleep .25; kill -s INT $$' ; end";
parser_t::principal_parser().eval(child_self_destructor, io_chain_t());
set_interactive_session(iis);
// Restore signal handling.
interactive.restore();
signal_reset_handlers();
// Ensure that we don't think we should cancel.

14
tests/checks/sigint2.fish Normal file
View File

@ -0,0 +1,14 @@
#RUN: %fish -C "set helper %fish_test_helper" %s
# Ensure that if child processes SIGINT, we exit our loops
# Test for #3780
echo About to sigint
#CHECK: About to sigint
while true
sh -c 'echo Here we go; sleep .25; kill -s INT $$'
end
#CHECK: Here we go
echo I should not be printed because of the SIGINT.