mojo script swallows stdout
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mojo: Continuous Delivery for Juju |
Confirmed
|
Medium
|
Unassigned |
Bug Description
I have some helper manifests/scripts (such as manifests/
Updating code asset from r2036 to r2045. Continue? [y/N]
Now (I assume since the logging changes), any sys.stdout.write isn't visible on the console, which leaves the script looking like it's hung. I've tried using logging.info() instead in my script, which doesn't work either (I assume because mojo is itself running my script via subprocess and doesn't inherit the logging config).
The only work-around I have at the moment is to not depend on any output/input for manifests, and run my script directly (rather than through mojo script).
Changed in mojo: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
This does indeed seem to be due to subprocess. check_output vs. subprocess. check_call in line 289 of mojo/phase.py. I'd imagine the best solution for this is to add an "interactive" option to the script phase, and if that's passed, to use subprocess. check_call rather than subprocess. check_output. This would mean you'd lose the ability to log the output, but since you're asking for it to happen interactively that may be okay. There may be some more complicated things we can do with subprocesses to display the prompt but still log everything, but depending on how much of a blocker this is that would be the quickest approach.