mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-20 23:04:12 +08:00
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:
parent
ae77f1b163
commit
7a2a6d76f3
@ -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
14
tests/checks/sigint2.fish
Normal 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.
|
Loading…
x
Reference in New Issue
Block a user