Skip to content

Commit 7fbc72c

Browse files
committed
Fix indentation
Just a quick attempt to get everything to use one indentation style. It seems like most of the code is using 4 spaces without tabs, so that's what I did.
1 parent b6ecb65 commit 7fbc72c

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

evalbot.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ package main;
354354
my $result = EvalbotExecuter::run($str, $e, $eval_name);
355355
my $revision = '';
356356
if (Scalar::Util::reftype($e) eq 'HASH' && $e->{revision}){
357-
$revision = ' ' . $e->{revision}->();
357+
$revision = ' ' . $e->{revision}->();
358358
}
359359
binmode STDOUT, ':utf8';
360360
print Evalbot::format_output("$eval_name$revision", $result);

lib/EvalbotExecuter.pm

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ my $max_output_len = 290;
8383
sub run {
8484
my ($program, $executer, $ename) = @_;
8585
if ($program =~ /^https:\/\/gist\.github\.com\/[^\/]+?\/(\p{HexDigit}+)$/) {
86-
my $page = `curl -s https://api.github.com/gists/\Q$1\E`;
87-
my $json = decode_json $page;
88-
if ($json->{message} && $json->{message} eq 'Not Found') {
89-
return 'gist not found';
90-
} else {
91-
$program = (values %{$json->{files}})[0]{content};
92-
}
86+
my $page = `curl -s https://api.github.com/gists/\Q$1\E`;
87+
my $json = decode_json $page;
88+
if ($json->{message} && $json->{message} eq 'Not Found') {
89+
return 'gist not found';
90+
} else {
91+
$program = (values %{$json->{files}})[0]{content};
92+
}
9393
} elsif ($program =~ /^https:\/\/github\.com\/([^\/]+\/[^\/]+)\/blob\/([^\/]+\/[^\/].*)$/) {
94-
my ($project, $file) = ($1, $2);
95-
my $page = `curl -s \Q$program\E`;
96-
if ($page =~ /href="\/$project\/raw\/$file"/) {
97-
$program
98-
= decode_utf8 `curl -s \Qhttps://raw.github.com/$project/$file\E`;
99-
} else {
100-
return 'file not found'
101-
};
94+
my ($project, $file) = ($1, $2);
95+
my $page = `curl -s \Q$program\E`;
96+
if ($page =~ /href="\/$project\/raw\/$file"/) {
97+
$program
98+
= decode_utf8 `curl -s \Qhttps://raw.github.com/$project/$file\E`;
99+
} else {
100+
return 'file not found'
101+
}
102102
} elsif ($program =~ /^https:\/\/bitbucket.org\/snippets\/([^\/]+)\/([^\/]+)$/) {
103103
my $page = `curl -s https://bitbucket.org/!api/2.0/snippets/\Q$1\E/\Q$2\E`;
104104
my $json = decode_json $page;
@@ -129,7 +129,7 @@ sub _fork_and_eval {
129129
_auto_execute($executer, $program, $fh, $filename, $ename);
130130
} else {
131131
# server
132-
alarm 22;
132+
alarm 22;
133133
local $SIG{ALRM} = sub {
134134
$timed_out = 1;
135135
kill 15, -$fork_val;
@@ -146,7 +146,7 @@ sub _fork_and_eval {
146146
my $result = do { local $/; <$fh> };
147147
unlink $filename or warn "couldn't delete '$filename': $!";
148148
if ($timed_out) {
149-
$result = "(timeout)" . $result;
149+
$result = "(timeout)" . $result;
150150
} elsif ($? & 127) {
151151
$result = "(signal " . (split ' ', $Config{sig_name})[$?] . ")" . $result;
152152
}

run.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ source /home/camelia/perl5/perlbrew/etc/bashrc
33
ulimit -u 80
44
ulimit -v 1048576
55
while true; do perl evalbot.pl $@ 2>&1 | tee ~/evalbot.log; sleep 1; done
6-

0 commit comments

Comments
 (0)