Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Proc::Background;
- my @commands = (
- ['./Files1.exe ALL'],
- ['./Files2.exe ALL'],
- ['./Files3.exe ALL'],
- ['./Files4.exe ALL'],
- );
- my @procs = map { Proc::Background->new(@$_) } @commands;
- $_->wait for @procs;
- system 'echo', 'CSCProc', '--pidsAndExitStatus', map { $_->pid, $_->wait } @procs;
- `mergefiles.exe`;
- my @scripts = qw(... commands ...);
- my @jobs = ();
- foreach my $script (@scripts) {
- my $job = threads->create( sub {
- system($script);
- });
- push @jobs, $job;
- }
- $_->join() foreach @jobs;
- #!/usr/bin/perl
- use strict; use warnings; use threads;
- my @scripts = (
- q(echo "script 1 reporting"),
- q(perl -e "sleep 2; print qq{hi there! This is script 2 reportingn}"),
- q(echo "script 3 reporting"),
- );
- my @jobs = map {
- threads->create(sub{
- system($_);
- });
- } @scripts;
- $_->join foreach @jobs;
- print "finished all my jobsn";
- system q(echo "This is the last job");
- C:...>perl stackoverflow.pl
- "script 1 reporting"
- "script 3 reporting"
- hi there! This is script 2 reporting
- finished all my jobs
- "This is the last job"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement