install.sh: eliminate spurious test_nc_U "Terminated" messages
commitafb7011ae16a00329a04049171b60bdf763aa530
authorKyle J. McKay <mackyle@gmail.com>
Sun, 28 Feb 2021 18:41:09 +0000 (28 11:41 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Sun, 28 Feb 2021 18:41:09 +0000 (28 11:41 -0700)
treed7113dfe692b021c9d46ac5d5d60c46516f7a7e4
parent99f293b4147dd4ac3fe131f0d0ac0a1d3681e5f6
install.sh: eliminate spurious test_nc_U "Terminated" messages

During the test to see if the configured "nc" command actually
supports the `-U` option, the background process that was doing
the listening gets explicitly killed.

If it has already exited, no problem, the message is suppressed
about an invalid PID and the error ignored.

If it hasn't, it's killed, but then, at some point, the shell
noticies that and wants to write out a "Terminated" notification
about the background process.

Unless, of course, the shell happens to be running with stderr
output redirected to /dev/null at the point it notices.

The test_nc_U function always runs with stderr output redirected
to /dev/null, but sometimes the terminated process does not
get noticed until later.

To try and address this, move the first "sleep 1" to immediately
after the backgrounding of the listen process to make sure it's
really been "exec'd" after forking.

Then add another "sleep 1" immediately after the "kill" of the
background process as apparently the shell only "notices" that
background processes have died just after it's executed an
external process.

The extra second will not matter to the total time taken for
the install process but hopefully will finally squelch the rare
spurious "Terminated" message.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
install.sh