diff options
author | Ayke van Laethem <aykevanlaethem@gmail.com> | 2018-07-22 16:30:37 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-08-04 15:45:23 +1000 |
commit | 0d7a0880396734c9b56b3d62d52d12c226597811 (patch) | |
tree | 9e26edbb55a8376e47eba825bf3b5aee00bce7a0 /tools/pyboard.py | |
parent | 6572029dc0665e58c2ea7355c9e541bdf83105a4 (diff) | |
download | micropython-0d7a0880396734c9b56b3d62d52d12c226597811.tar.gz micropython-0d7a0880396734c9b56b3d62d52d12c226597811.zip |
tools/pyboard: Run exec: command as a string.
The Python documentation recommends to pass the command as a string when
using Popen(..., shell=True). This is because "sh -c <string>" is used to
execute the command and additional arguments after the command string are
passed to the shell itself (not the executing command).
https://docs.python.org/3.5/library/subprocess.html#subprocess.Popen
Diffstat (limited to 'tools/pyboard.py')
-rwxr-xr-x | tools/pyboard.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/pyboard.py b/tools/pyboard.py index 16ee41f703..8ccc869d10 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -152,7 +152,7 @@ class ProcessToSerial: def __init__(self, cmd): import subprocess - self.subp = subprocess.Popen(cmd.split(), bufsize=0, shell=True, preexec_fn=os.setsid, + self.subp = subprocess.Popen(cmd, bufsize=0, shell=True, preexec_fn=os.setsid, stdin=subprocess.PIPE, stdout=subprocess.PIPE) # Initially was implemented with selectors, but that adds Python3 |