Subversion Repositories wimsdev

Rev

Rev 6774 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /usr/bin/perl
use strict;
use IPC::Open3;

my $launcher = -f "../chroot/usr/local/bin/chemeq" ? "ch..root" : "wrap..exec";

my $wims_exec_parm = $ENV{'wims_exec_parm'};

my $pid = open3(\*CHLD_IN, \*CHLD_OUT, \*CHLD_ERR, "bin/$launcher chemeq -l") or die "open3() failed $!";

print CHLD_IN "$wims_exec_parm\n";
close(CHLD_IN);

my $tmp ="";
while(<CHLD_OUT>){
    $tmp .= $_;
}

my $err = <CHLD_ERR>;
print $tmp;


if ($err =~ /ERROR/){
    my ($sec,$min,$hour,$day,$month,$yr19,@rest) =   localtime(time);
    my $d = sprintf qq{%04d/%02d/%02d-%02d:%02d:%02d},
      1900+$yr19, $month, $day, $hour, $min, $sec;
    print "Write to log:\n$d chemeq: $wims_exec_parm";
    my $log;
    open $log, ">>../log/user_error.log" or die $!;
    print $log "$d chemeq: $wims_exec_parm";
}