I am trying to run a script from a program created in perlTk. When I hit the RUN button, it runs this run_program function. It runs through the process fine and prints out the Process complete line and then gives me some weird messages: Process complete X Error of failed request: BadIDChoice (invalid resource ID chosen for this connection) Major opcode of failed request: 53 (X_CreatePixmap) Resource id in failed request: 0x100004f Serial number of failed request: 25739 Current serial number in output stream: 24474 I think it has something to do with the unless(fork), I've read several examples of using fork but can't seem to figure out how to use it in the context that I want! The reason I am using the fork is so I can have access to the window and be able to check the status of the job, i.e. which step I'm at or how many jobs have completed. Any ideas are highly appreciated. Thanks, Tom sub run_program { my $inputfile; my $cmdline; my @running; my $tot_running; my $tot_files; my $tot_done; my $segment; my $locdir; $step++; # step 1 run input command print STDOUT "Running input command $in_cmnd\n"; system ("$in_cmnd"); print STDOUT "Running Script\n"; $step++; # Run as child process so can still use window????? unless(fork) { JOBS: for(;;) { @running=glob("$base/running.$pid.???"); $tot_running=@running+0; $tot_files=0; $tot_done=0; JOB: foreach $inputfile (glob("$in_dsn.???")) { $tot_files++; $segment=substr($inputfile,-3); # it's done if (open CHECK, "$base/done.$pid.$segment") { unlink "$base/running.$pid.$segment"; unlink "$base/done.$pid.$segment"; unlink "$inputfile"; $tot_done++; close CHECK; next JOB; } if (open ERROR, "$base/error.$pid.$segment") { system("rm $base/running.$pid.$segment 2> /dev/null"); print STDOUT "There was an error running segment $segment\n"; error_message("There was an error running segment $segment\n"); $tot_done++; close ERROR; next JOB; } if (open RUNNING, "$base/running.$pid.$segment") { next JOB; close RUNNING; } # launch the process if ($tot_running < $num_process) { $locdir = "/\U$mnem/$pid/$segment"; system("mkdir -p $locdir"); $cmdline="cd $locdir ;nohup $script $pid.$segment $pid.$segment \L$filter\E 01 $no_mnths N >stdout 2>stderr &"; print STDOUT "Running\n$cmdline\n"; system("$cmdline"); system("echo xxx > $base/running.$pid.$segment"); $tot_running++; } } # for each file # break out of the loop when all files are processed last JOBS if $tot_done == $tot_files; sleep(10); } $step++; # step 3, run output command print STDOUT "Running $out_cmnd\n"; system("$out_cmnd"); $step++; # step 4, merge reports print STDOUT "Mergeing reports\n"; &merge_forms; print STDOUT "\nProcess complete\n\n"; } # end of fork } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]