F
F
falshunov2018-03-14 20:26:46
linux
falshunov, 2018-03-14 20:26:46

How to throw all commands to the console from a python program?

Gentlemen, I'm in a python not in the tooth with my foot. I found such an answer to my question, but, as I understand it, it says here how to throw one command into a subprocess, and how is it possible to completely transfer the entire stdin so that any interaction with the subprocess happens transparently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2018-03-15
@vintello

I didn't check the code, but I think you get the idea

from subprocess import Popen
import logging

log =logging.getLogger(__name__)
with Popen(["dir"], stdout=PIPE) as proc:
    log.write(proc.stdout.read())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question