3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 20:09:43 +01:00

Fix trailing whitespace throughout

This commit is contained in:
Pragmatic Software 2019-06-26 09:34:19 -07:00
parent 8b5de0beee
commit 5e2cb09744
88 changed files with 1326 additions and 1338 deletions

View File

@ -115,7 +115,7 @@ sub on_motd {
sub on_self_join { sub on_self_join {
my ($self, $event_type, $event) = @_; my ($self, $event_type, $event) = @_;
$self->send_who($event->{channel}); #$self->send_who($event->{channel});
return 0; return 0;
} }

View File

@ -12,7 +12,7 @@
use warnings; use warnings;
use strict; use strict;
use IO::Socket::INET; use IO::Socket;
use JSON; use JSON;
my $sock = IO::Socket::INET->new( my $sock = IO::Socket::INET->new(
@ -20,16 +20,13 @@ my $sock = IO::Socket::INET->new(
PeerPort => 9000, PeerPort => 9000,
Proto => 'tcp'); Proto => 'tcp');
if (not defined $sock) { if(not defined $sock) {
print "Fatal error compiling: $!; try again later\n"; print "Fatal error compiling: $!; try again later\n";
die $!; die $!;
} }
my $json = join ' ', @ARGV; my $json = join ' ', @ARGV;
my $length = length $json; print STDERR "join = $json?\n";
print STDERR "got $length bytes of argv json: [$json]\n";
my $h = decode_json $json; my $h = decode_json $json;
my $lang = $h->{lang} // "c11"; my $lang = $h->{lang} // "c11";
@ -40,13 +37,9 @@ if ($h->{code} =~ s/-lang=([^ ]+)//) {
$h->{lang} = $lang; $h->{lang} = $lang;
$json = encode_json $h; $json = encode_json $h;
$length = length $json; print $sock "$json\n";
print STDERR "got $length bytes of json: [$json]\n"; while(my $line = <$sock>) {
syswrite($sock, "$json\n");
while (my $line = <$sock>) {
print "$line"; print "$line";
} }

View File

@ -41,9 +41,9 @@ sub vm_start {
sub vm_reset { sub vm_reset {
return if $ENV{NORESET}; return if $ENV{NORESET};
system("virsh detach-disk $DOMAIN_NAME vdb"); #system("virsh detach-disk $DOMAIN_NAME vdb");
system("virsh snapshot-revert $DOMAIN_NAME 1"); system("virsh snapshot-revert $DOMAIN_NAME 1");
system("virsh attach-disk $DOMAIN_NAME --source /var/lib/libvirt/images/factdata.qcow2 --target vdb"); #system("virsh attach-disk $DOMAIN_NAME --source /var/lib/libvirt/images/factdata.qcow2 --target vdb");
print "Reset vm\n"; print "Reset vm\n";
} }
@ -174,7 +174,7 @@ sub compiler_server {
if ($heartbeat == -1) { if ($heartbeat == -1) {
print "fucking dead, restarting\n"; print "fucking dead, restarting\n";
waitpid $heartbeat_pid, 0; waitpid $heartbeat_pid, 0;
# vm_stop; #vm_stop;
next; next;
} }
@ -259,7 +259,7 @@ sub compiler_server {
next; next;
print "stopping vm\n"; print "stopping vm\n";
vm_stop; #vm_stop;
$running = 0; $running = 0;
last; last;
} }

View File

@ -28,7 +28,7 @@ sub postprocess {
print "Executing java\n"; print "Executing java\n";
my $input_quoted = quotemeta $self->{input}; my $input_quoted = quotemeta $self->{input};
$input_quoted =~ s/\\"/"'\\"'"/g; $input_quoted =~ s/\\"/"'\\"'"/g;
my ($retval, $result) = $self->execute(60, "date -s \@$self->{date}; ulimit -t 5; echo $input_quoted | java prog $self->{arguments} > .output"); my ($retval, $result) = $self->execute(60, "bash -c \"date -s \@$self->{date}; ulimit -t 5; echo $input_quoted | java prog $self->{arguments} > .output\"");
$result = ""; $result = "";
open(FILE, '.output'); open(FILE, '.output');

View File

@ -17,7 +17,7 @@ sub postprocess {
$self->{output} = "[$self->{output}]\n"; $self->{output} = "[$self->{output}]\n";
} }
my ($retval, $result) = $self->execute(60, "date -s \@$self->{date}; ulimit -t 5; cat .input | /home/compiler/prog > .output"); my ($retval, $result) = $self->execute(60, "bash -c \"date -s \@$self->{date}; ulimit -t 5; cat .input | /home/compiler/prog > .output\"");
$self->{error} = $retval; $self->{error} = $retval;

View File

@ -51,11 +51,6 @@ if (@$args == 0) {
close $fh; close $fh;
} }
if ($args =~ m/afroman/) {
print "Oh fuck off.\n";
exit;
}
my $ud = WebService::UrbanDictionary->new; my $ud = WebService::UrbanDictionary->new;
my $results = $ud->request($args); my $results = $ud->request($args);