Skip to content

Commit a32bb60

Browse files
committed
Make Evalable ignore ‘???’ and ‘sleep &’
These just happen to be common and somewhat valid.
1 parent c1e3457 commit a32bb60

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

xbin/Evalable.p6

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ multi method irc-privmsg-channel($msg) {
4747
my $nonword-ratio = $msg.args[1].comb(/<-alpha -space>/) ÷ $msg.args[1].chars;
4848
nextsame if $nonword-ratio < 0.1; # skip if doesn't look like code at all
4949
nextsame if $msg.args[1] ~~ /^ \s*<[\w-]>+‘:’ /; # skip messages to other bots
50+
nextsame if $msg.args[1] eq ???; # unfortunate trigger (???)
51+
nextsame if $msg.args[1] ~~ /^ \w+ \s+ ‘&’ \s* $/; # unfortunate trigger (sleep &)
5052

5153
self.process: $msg, $msg.args[1], :good-only
5254
}

xt/evalable.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ $t.test(‘segfaults are not ignored’,
228228
use NativeCall; sub strdup(int64) is native(Str) {*}; strdup(0),
229229
/^ <me($t)>‘, rakudo-moar ’<sha>‘: OUTPUT: «(signal SIGSEGV) »’ $/);
230230

231+
$t.test(ignore common messages (sleep &),
232+
sleep &);
233+
234+
$t.test(ignore common messages (???),
235+
???);
236+
231237
# Timeouts
232238

233239
$t.test(timeout,

0 commit comments

Comments
 (0)