3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Limit qalc cpu time

This commit is contained in:
Pragmatic Software 2017-10-05 19:37:05 -07:00
parent 0fcbaaad4b
commit cfc8ec9f06

View File

@ -9,14 +9,12 @@ use strict;
my $args = join ' ', @ARGV; my $args = join ' ', @ARGV;
my $qargs = quotemeta $args; if (not length $args) {
if (not length $qargs) {
print "Usage: qalc <expression>\n"; print "Usage: qalc <expression>\n";
exit; exit;
} }
my $result = `qalc $qargs`; my $result = `ulimit -t 2; qalc '$args'`;
$result =~ s/^.*approx.\s+//; $result =~ s/^.*approx.\s+//;
$result =~ s/^.*=\s+//; $result =~ s/^.*=\s+//;