diff --git a/src/builtin_block.cpp b/src/builtin_block.cpp index 72652e683..dfe8ef046 100644 --- a/src/builtin_block.cpp +++ b/src/builtin_block.cpp @@ -102,7 +102,6 @@ int builtin_block(parser_t &parser, io_streams_t &streams, wchar_t **argv) { block_t *block = parser.block_at_index(block_idx); event_blockage_t eb = {}; - eb.typemask = (1 << EVENT_ANY); switch (opts.scope) { case LOCAL: { diff --git a/src/parser.h b/src/parser.h index 6edea461e..17b1f970f 100644 --- a/src/parser.h +++ b/src/parser.h @@ -20,24 +20,14 @@ class io_chain_t; -/// event_blockage_t represents a block on events of the specified type. +/// event_blockage_t represents a block on events. struct event_blockage_t { - /// The types of events to block. This is interpreted as a bitset whete the value is 1 for every - /// bit corresponding to a blocked event type. For example, if EVENT_VARIABLE type events should - /// be blocked, (type & 1< event_blockage_list_t; inline bool event_block_list_blocks_type(const event_blockage_list_t &ebls, int type) { - for (event_blockage_list_t::const_iterator iter = ebls.begin(); iter != ebls.end(); ++iter) { - if (iter->typemask & (1 << EVENT_ANY)) return true; - if (iter->typemask & (1 << type)) return true; - } - return false; + return !ebls.empty(); } /// Types of blocks. diff --git a/tests/signal.in b/tests/signal.in index 76db56d2d..118c1d2e5 100644 --- a/tests/signal.in +++ b/tests/signal.in @@ -2,7 +2,6 @@ function alarm --on-signal ALRM echo ALRM received end - kill -s ALRM $fish_pid function anychild --on-process-exit 0 @@ -10,6 +9,17 @@ function anychild --on-process-exit 0 echo $argv[1] $argv[3] end +echo "command false:" command false +echo "command true:" command true +echo "command false | true:" command false | command true + +function test_blocks + block -l + command echo "This is the process whose exit event shuld be blocked" + echo "This should come before the event handler" +end +test_blocks +echo "Now event handler should have run" diff --git a/tests/signal.out b/tests/signal.out index 234258bf5..10aa9b5f3 100644 --- a/tests/signal.out +++ b/tests/signal.out @@ -1,9 +1,17 @@ ALRM received +command false: PROCESS_EXIT 1 JOB_EXIT 0 +command true: PROCESS_EXIT 0 JOB_EXIT 0 +command false | true: PROCESS_EXIT 1 PROCESS_EXIT 0 JOB_EXIT 0 +This is the process whose exit event shuld be blocked +This should come before the event handler +PROCESS_EXIT 0 +JOB_EXIT 0 +Now event handler should have run PROCESS_EXIT 0