I have a (Java) process which is staring a separate process
foo takes some number of seconds to start up, then is really running. Control returns back to the parent process as soon as
foo is started, but not necessarily ready.
Note also that
foo writes human-readable output to both
stdout and, in debug mode,
The options I'm aware of:
sleepthe parent process for
nis theoretically larger than
foowill ever take.
- Have the parent process looking for something special in the child's
stderr, and block until it's seen.
- Touch some sort of marker file in the OS when
foois ready, and have the parent process watch that file.
I don't really like any of these options (1. has a race condition, 2. involves matching magic strings, and 3. risks multiple
foo processes colliding). Going the other way (parent to child) I could send a signal to communicate, but I'm not aware of a better way for the child process to communicate its state to the parent.