From ff2beb1f14a7277cbdfb94ebde60028dfd806fa9 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 31 May 2019 11:07:05 -0700 Subject: [PATCH] compiler_vm: -input flag once again works with all languages --- .../compiler_vm/languages/server/_default.pm | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/modules/compiler_vm/languages/server/_default.pm b/modules/compiler_vm/languages/server/_default.pm index 0969c3d1..ebcde229 100755 --- a/modules/compiler_vm/languages/server/_default.pm +++ b/modules/compiler_vm/languages/server/_default.pm @@ -35,6 +35,20 @@ sub initialize { sub preprocess { my $self = shift; + my $input = $self->{input}; + $input = "" if not defined $input; + + print "writing input [$input]\n"; + + $input =~ s/(?', '.input'); + print $fh "$input\n"; + close $fh; + if ($self->{code} =~ m/print_last_statement\(.*\);$/m) { # remove print_last_statement wrapper in order to get warnings/errors from last statement line my $code = $self->{code}; @@ -63,7 +77,7 @@ sub preprocess { close $fh; print "Executing [$self->{cmdline}]\n"; - my ($retval, $result) = $self->execute(60, "date -s \@$self->{date} > /dev/null; ulimit -t 5; $self->{cmdline}"); + my ($retval, $result) = $self->execute(60, "date -s \@$self->{date} > /dev/null; ulimit -t 5; $self->{cmdline} < .input"); $self->{output} = $result; $self->{error} = $retval; } @@ -71,21 +85,6 @@ sub preprocess { sub postprocess { my $self = shift; - - my $input = $self->{input}; - - print "writing input [$input]\n"; - - $input =~ s/(?', '.input'); - print $fh "$input\n"; - close $fh; } sub execute {