Make the test program explicitly flush lines written to stdout and
stderr, and do not use stdbuf to force line buffering for stdout.
In Python 2 stderr was unbuffered, but in Python 3 it is block-buffered
when redirected to a file/pipe. Besides, stdbuf seems to have no effect
on Python 3.
This solves one of the problems with this test described in #3361.
The problem ocurred with Python 3 and after the addition of the
wait_file_lines check in v8.40.0. The buffering that Python did caused
the last two lines of the output file to be written at shutdown time.
Other minor fixes and consistency enhancements in other omprog tests.
Python3 writes to stderr immediately, and this caused the
captured output to differ with respect to Python2. Simplified
the test to do a single write to stderr. Also a cast to int
was needed when calculating 'numRepeats'.
closes#3030
Capture program output using a pipe shared with all child processes,
and write to the file using a dedicated thread. Ensures lines emitted
by the child processes will not be intermingled in the output file if
the lines are less than PIPE_BUF chars long and are written in line-
buffered mode.
Reopen output file on HUP, to support external rotation of the file.
New setting 'fileCreateMode' as in omfile.
With these improvements the 'output' setting should now be usable for
production (it was originally intended only for debugging).
Redirect stdout/stderr of child process to /dev/null when not captured.
Closes#2787
Minor: simplify some test code: 'wait-startup' not needed after
'startup', 'wait-queueempty' not needed before 'shutdown_when_empty'.