in reply to Re: Threads Printing Issue - Output Mangled / Term Crashing
in thread Threads Printing Issue - Output Mangled / Term Crashing

Well I have a lot of other scripts that create many simultaneous SSH connections at once (with no issues like this, even printing out data, etc). However, this is the first time I've had to use the SSH -tt option to force Force pseudo-tty allocation on the remote systems. This is because tcpdump doesn't die after the SSH connection is closed without it (at least until it sees a packet that matches the filter).
  • Comment on Re^2: Threads Printing Issue - Output Mangled / Term Crashing

Replies are listed 'Best First'.
Re^3: Threads Printing Issue - Output Mangled / Term Crashing
by salva (Canon) on Apr 14, 2014 at 12:03 UTC
    Then, and easy workaround is to write a wrapper for tcpdump that launches it and then kills it when stdin is closed:
    #!/usr/bin/perl # untested: require POSIX; my $pid = fork; unless ($pid) { exec 'tcpdump', @ARGV; POSIX::_exit(1); } while (<>) { ; }; # just discard input until EOF kill KILL => $pid;
    You will have to place the wrapper on the remote machines (or just make it into a perl one-liner and pass it on the ssh call)
      But do you think the SSH -t options are what's causing the issue?
        I don't see any error on your code so I blame the unknown! :-)

        Now seriously, yes, the TTY handling code in OpenSSH is quite hairy and bugs there are not so uncommon as one would like.