ssh commands break tests

Issue #18 resolved
kra
created an issue

I need to ssh to remote sites to perform setup/teardown. ssh commands seem to stop tests from proceeding. Subsequent tests in separate test files don't seem to be affected.

{{{ $ echo foo foo this works $ ssh localhost echo foo foo next command doesn't produce output $ echo bar this comment and commands below it are treated as errors $ echo baz $ echo qux }}}

Comments (5)

  1. Brodie Rao repo owner

    I did a quick investigation, and it looks like the shell exits with 0 after running the SSH command and printing its output.

    I'll have to do some more investigation to see what's really happening.

  2. kra reporter

    ssh -n (redirect stdin from /dev/null) seems to be a workaround. Maybe ssh is closing stdin?

    ssh -n works (redirect stdin from /dev/null).
      $ ssh -n localhost echo foo
      foo
      $ echo bar
      bar
      $ echo baz
      baz
    plain ssh does not
      $ ssh localhost echo foo
      foo
      $ echo bar
    this comment and the line after are treated as errors
      $ echo baz
    

    I thought that an alternative to subprocess.PIPE in the Popen call might fix this, but a StringIO can't be used, it needs to have a real file descriptor (http://bugs.python.org/issue5313). A temp file or a named pipe created with the OS might work?

  3. Brodie Rao repo owner

    I'm not sure this is worth working around in Cram, but it might be good to make note of this in the README (and mention how to work around it in the test).

  4. Log in to comment