0

I have a makefile that calls external build scripts.

Some of these scripts (which I can't change) make use of commands that are forked / backgrounded (or asynchronous as the bash manual names them)

That means that the next line in the makefile can start before some of the previous command finishes - creating a race condition.

I somehow need to either wait on the forked process and all it's children, or simply prevent any command or subcommand of subsequent scripts running in the background.

Is there a way to prevent this, i.e. disable the ampersand '&' suffix to commands in the current and child subshells?

Jay M
  • 358
  • 4
  • 10

1 Answers1

0

One possible way is to create a copy of these scripts and remove the constructions with make some command to run in background. Be warned you may do not want to remove all & automatically because you may mess commands like:

command && command 

The other possible way is to ask for permission to edit the scripts (instead of copy them)

Romeo Ninov
  • 3,195
  • 2
  • 13
  • 16