Issue #17 open

--debug for printing commands as they execute

Brodie Rao
staff repo owner created an issue

It'd be nice to be able to run cram --debug test.t and see the test's input/output as it runs.

I took a stab at this last night, but ran into a number of problems:

  • We'd have to change how we buffer input/output to the subprocess. I'm not sure what practical effect this would have. Right now we let the OS decide the buffering (bufsize=-1).
  • We wouldn't be able to use p.communicate() to send stdin and read stdout. The Python docs seem to imply using communicate() is the only reliable way to communicate with a subprocess without potentially getting tripped up by buffer limits.
  • To interactively print the test, as it executes, in the test format (not the intermediate script that we generate), we have to read from stdout process the output at the same time. It seems easy to print a command group after it's run (when we see a salt, we can process what's in our postout buffer). However, I'm not sure how to show the command currently being executed. I think we'd have to generate a "post" salt and inject that into the script output as well.

Comments (6)

  1. Brodie Rao staff reporter

    Another random thought: it'd be neat to have a special output format that printed the line numbers of the test as they executed (instead of the lines themselves). This could be hooked up to editors/IDEs/whatever to highlight lines in the test as they run.

  2. Log in to comment