in reply to Re: Problem invoking Matlab from Perl: works on Linux, fails on Windows
in thread Problem invoking Matlab from Perl: works on Linux, fails on Windows
This method is not atomic, but will probably be ok in the environment the code will run in. find_win32_pids() uses pslist, a free Microsoft download, that's a ps lookalike. I was unable to get WMIC to work from Perl, although it worked ok from the command line. Thanks to everyone for their help.my @matlab_pids_before = find_win32_pids("matlab"); system($matlab_cmd_str) == 0 or die("Unable to invoke $matlab_cmd_str\ +n"); my @matlab_pids_after = find_win32_pids("matlab"); my @pid = find_new_pid(\@matlab_pids_before, \@matlab_pids_after); if ($#pid != 0) { die(sprintf("Expecting one new matlab PID, found %d new matlab pids" +,1+$#pid)); } waitpid($pid[0], 0); # Wait here until Matlab completes.
|
|---|