http://www.perlmonks.org?node_id=11121872


in reply to Re: net::OpenSSH several commands, stdout are mixed up
in thread net::OpenSSH several commands, stdout are mixed up

I tried something. I added a tee to the remote command to log its output in a file (on the host, a different file for each call).
It appears that it is traceroute that is mixing up its outputs on the host; Net::OpenSSH is working fine.

For info, what the recorded file through tee is returning (second line is wrong and belongs to another traceroute call, but the hop number is wrong as well as in the other call, it is hop #1, this ip is never hop #5).
root@HERMES:/tmp/mnt/sda1$ cat test_77.95.71.196.tee traceroute to 77.95.64.123 (77.95.64.123), 6 hops max, 38 byte packets 5 10.2.0.211 8.592 ms 2.467 ms 2.718 ms 2.530 ms 2.561 ms 2.56 +1 ms 2.687 ms 2.749 ms 2.405 ms 2.561 ms 2.562 ms 2.562 ms 6 77.95.70.196 18.432 ms 18.244 ms 18.431 ms 18.119 ms 18.463 m +s 18.213 ms 18.619 ms 18.151 ms 18.369 ms 18.119 ms 18.556 ms +18.682 ms
What the traceroute should return:
root@HERMES:/tmp/mnt/sda1$ traceroute -w 1 -f 5 -m 6 -q 12 -n 77.95.64 +.123 traceroute to 77.95.64.123 (77.95.64.123), 6 hops max, 38 byte packets 5 77.95.71.196 18.806 ms 18.244 ms 18.619 ms 17.995 ms 18.807 m +s 18.463 ms 18.495 ms 18.307 ms 18.744 ms 18.276 ms 18.588 ms +18.307 ms 6 77.95.70.196 18.588 ms 18.276 ms 18.432 ms 18.089 ms 18.588 m +s 18.088 ms 18.463 ms 18.119 ms 18.432 ms 18.151 ms 18.588 ms +18.181 ms

So this traceroute does not work properly when called multiple times at the same time.
Net::OpenSSH output is similar to the one on the tee file, so behaves as expected.