Rev 6774 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6807 | georgesk | 1 | #! /usr/bin/perl |
2 | use strict; |
||
3 | use IPC::Open3; |
||
14 | reyssat | 4 | |
6807 | georgesk | 5 | my $launcher = -f "../chroot/usr/local/bin/chemeq" ? "ch..root" : "wrap..exec"; |
14 | reyssat | 6 | |
6807 | georgesk | 7 | my $wims_exec_parm = $ENV{'wims_exec_parm'}; |
14 | reyssat | 8 | |
6807 | georgesk | 9 | my $pid = open3(\*CHLD_IN, \*CHLD_OUT, \*CHLD_ERR, "bin/$launcher chemeq -l") or die "open3() failed $!"; |
10 | |||
11 | print CHLD_IN "$wims_exec_parm\n"; |
||
12 | close(CHLD_IN); |
||
13 | |||
14 | my $tmp =""; |
||
15 | while(<CHLD_OUT>){ |
||
16 | $tmp .= $_; |
||
17 | } |
||
18 | |||
19 | my $err = <CHLD_ERR>; |
||
20 | print $tmp; |
||
21 | |||
22 | |||
23 | if ($err =~ /ERROR/){ |
||
24 | my ($sec,$min,$hour,$day,$month,$yr19,@rest) = localtime(time); |
||
25 | my $d = sprintf qq{%04d/%02d/%02d-%02d:%02d:%02d}, |
||
26 | 1900+$yr19, $month, $day, $hour, $min, $sec; |
||
27 | print "Write to log:\n$d chemeq: $wims_exec_parm"; |
||
28 | my $log; |
||
29 | open $log, ">>../log/user_error.log" or die $!; |
||
30 | print $log "$d chemeq: $wims_exec_parm"; |
||
31 | } |