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
This commit is contained in:
Ayke van Laethem 2018-07-22 16:30:37 +02:00 committed by Damien George
parent 6572029dc0
commit 0d7a088039
1 changed files with 1 additions and 1 deletions

View File

@ -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