Changeset 22427
- Timestamp:
- Feb 24, 2009, 10:58:24 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/register_imfile.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/register_imfile.pl
r22421 r22427 17 17 use Storable qw(freeze thaw); 18 18 use File::Basename qw( basename); 19 use IPC::Run qw( harness run ); 19 use IPC::Run; 20 use IPC::Cmd 0.36 qw( can_run ); 20 21 use PS::IPP::Config 1.01 qw( :standard ); 21 22 use PS::IPP::Metadata::Config; … … 30 31 # Look for programs we need 31 32 my $missing_tools; 32 my $regtool = `which regtool` or (warn "Can't find regtool" and $missing_tools = 1); 33 my $ppStats = `which ppStats` or (warn "Can't find ppStats" and $missing_tools = 1); 34 my $ppStatsFromMetadata = `which ppStatsFromMetadata` or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 35 chomp $regtool; 36 chomp $ppStats; 37 chomp $ppStatsFromMetadata; 33 my $regtool = can_run( 'regtool' ) or (warn "Can't find regtool" and $missing_tools = 1); 34 my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1); 35 my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 38 36 39 37 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $dbname, $verbose, $no_update, $no_op, $logfile); … … 95 93 # Run ppStats 96 94 my ($in1, $out1, $err1); # Buffers for ppStats 97 my $h1 = harness \@command1, \$in1, \$out1, \$err1;95 my $h1 = IPC::Run::harness \@command1, \$in1, \$out1, \$err1; 98 96 print "[Running $command1]\n"; 99 my $result1 = run $h1;100 print $out1;101 print $err1;97 my $result1 = IPC::Run::run $h1; 98 print "STDOUT:\n$out1"; 99 print "STDERR:\n$err1"; 102 100 &my_die("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h1->result() ) unless $result1; 103 101 104 102 print "[Running " . join(' ', @command2) . "]\n"; 105 103 my ($out2, $err2); # Buffers for ppStatsFromMetadata 106 my $h2 = harness \@command2, \$out1, \$out2, \$err2;104 my $h2 = IPC::Run::harness \@command2, \$out1, \$out2, \$err2; 107 105 print "[Running $command2]\n"; 108 my $result2 = run $h2;109 print $out2;110 print $err2;106 my $result2 = IPC::Run::run $h2; 107 print "STDOUT:\n$out2"; 108 print "STDERR:\n$err2"; 111 109 &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h2->result() ) unless $result2; 112 110 chomp $out2; … … 168 166 # Push the results into the database 169 167 unless ($no_update) { 168 my ($in1, $out1, $err1); # Buffers for ppStats 169 my $h1 = harness \@command1, \$in1, \$out1, \$err1; 170 print "[Running $command1]\n"; 171 my $result1 = run $h1; 172 170 173 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 run(command => $command, verbose => $verbose);174 IPC::Cmd::run(command => $command, verbose => $verbose); 172 175 unless ($success) { 173 176 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 190 193 return @{thaw $cmd_output}; 191 194 } else { 192 my @output = run(%p);195 my @output = IPC::Cmd::run(%p); 193 196 $c->set($p{command}, freeze \@output) if $cache; 194 197 return @output;
Note:
See TracChangeset
for help on using the changeset viewer.
