in reply to Execution of external command hangs
Does anything in your app set $/?
Try adding the local line below:
sub returnVersion() { my $cmdToExecute = "dds_cmd -Version "; my $versionNum; my $PH; if (!open($PH, "$cmdToExecute 2>&1 |")) { print STDERR "Failed to execute command:($cmdToExecute)--$!\n"; exit 1; } local $/ = "\n"; ################### while (my $line = <$PH>) { if (index($line, "Command Execution ") != -1){ $line =~ s/^.+version\s|\.0.$//g; $versionNum = $line; } } close($PH); return $versionNum; }
|
|---|