Skip to content

Commit

Permalink
util: testing: consoletest: commands: Allow reading from stdin if CON…
Browse files Browse the repository at this point in the history
…SOLETEST_STDIN environment variable is set

Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
  • Loading branch information
pdxjohnny committed Jun 23, 2022
1 parent 4863a39 commit 9c8a38a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dffml/util/testing/consoletest/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ async def run_commands(
# Set stdout to system stdout so it doesn't go to the pty
kwargs["stdout"] = stdout if stdout is not None else sys.stdout
# Check if there is a previous command
kwargs["stdin"] = stdin if stdin is not None else subprocess.DEVNULL
kwargs["stdin"] = (
stdin
if (stdin is not None or os.environ.get("CONSOLETEST_STDIN", ""))
else subprocess.DEVNULL
)
if i != 0:
# NOTE asyncio.create_subprocess_exec doesn't work for piping output
# from one process to the next. It will complain about stdin not
Expand Down

0 comments on commit 9c8a38a

Please sign in to comment.