File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1309,6 +1309,12 @@ sub Build {
1309
1309
foreach my $srcfile (' perl.com' , ' perl.com.dbg' ) {
1310
1310
my $destfile = $itemconfig -> {dest };
1311
1311
$destfile .= ' .dbg' if ($srcfile =~ / dbg$ / );
1312
+ if (-f $destfile ) {
1313
+ # avoid bus error by renaming the existing executable
1314
+ my $olddest = " $destfile .old" ;
1315
+ print " mv $destfile $olddest \n " ;
1316
+ move($destfile , $olddest ) or die " move failed: $! " ;
1317
+ }
1312
1318
my @args = (" $UserProjectConfig ->{apperl_output}/$CurAPPerlName /o/$srcfile " , $destfile );
1313
1319
-e $args [0] or next ;
1314
1320
print ' cp ' .join (' ' , @args )." \n " ;
@@ -1477,14 +1483,11 @@ sub _cmdoutput_or_die {
1477
1483
sub _cmdinputfile_or_die {
1478
1484
my $input_file = pop @_ ;
1479
1485
print join (' ' , @_ ), " < $input_file \n " ;
1480
- my $kid = fork () // die " forking failed" ;
1481
- if ($kid == 0) {
1482
- open (STDIN , ' <' , $input_file ) or die " Can't dup to STDIN" ;
1483
- exec { $_ [0] } @_ ;
1484
- die " exec failed"
1485
- }
1486
- waitpid ($kid , 0);
1487
- (($? >> 8) == 0) or die (" child failed" );
1486
+ $SIG {PIPE } = " IGNORE" ;
1487
+ open (my $to_kid , ' |-' , @_ ) or die " Can't fork: $! " ;
1488
+ copy($input_file , $to_kid ) or die " failed to copy $! " ;
1489
+ close ($to_kid );
1490
+ (($? >> 8) == 0) or die " child failed $? " ;
1488
1491
}
1489
1492
1490
1493
sub _setup_repo {
You can’t perform that action at this time.
0 commit comments