diff --git a/tests/ssh.py b/tests/ssh.py index aba4ce9..7c00198 100755 --- a/tests/ssh.py +++ b/tests/ssh.py @@ -2,11 +2,21 @@ import sys from command import Command +class SSHCommand(Command): + def __init__(self, address, command): + opts = ('StrictHostKeyChecking=no', + 'PasswordAuthentication=no') + + argv = ['ssh'] + for opt in opts: + argv += [ "-o", opt ] + + argv += [ address, command ] + Command.__init__(self, argv, setpgrp=True) + command = 'echo HOME=$HOME; echo pid=$$; (while true; do sleep 1; echo hello; done)' -args = ('ssh', - 'd', - command) -c = Command(args, setpgrp=True) + +c = SSHCommand('d', command) def cb(c, buf): if buf: sys.stdout.write(buf)