Improve Eshell's behavior when waiting for processes
This has a few benefits. First, it fixes a race condition when killing
old processes in 'eshell-command'. Second, the "wait" built-in command
is now more useful. Finally, killing processes when exiting Eshell (via
'eshell-round-robin-kill') should be much faster.
* lisp/eshell/esh-proc.el (esh-opt): Require.
(eshell-wait-for-process): Make obsolete in favor of...
(eshell-wait-for-processes): ... this. Accept a timeout and support
PIDs. Update callers.
(eshell/wait): New implementation accepting -t/--timeout.
(eshell-round-robin-kill): Use 'eshell-wait-for-processes'.
* lisp/eshell/eshell.el (eshell-command): Use 'eshell-round-robin-kill'.
* doc/misc/eshell.texi (List of Built-ins): Document the new "wait"
behavior.
* etc/NEWS: Announce this change.
(cherry picked from commit
8e46f44ea0eb761e24beda8c5cdbc8fcca87307a)