Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: Make subprocess.Popen params Py2 and Py3 compatible #2596

Merged
merged 2 commits into from Sep 3, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

BF: Create list of string args for subprocess so no string split needed

Splitting the string for the args param in subprocess was causing filenames
with spaces to be split at the space. This fix creates the list of
strings of required commands so no string split method is needed. Part fix
for https://discourse.psychopy.org/t/new-release-3-2-0/8931/7
  • Loading branch information...
dvbridges committed Sep 3, 2019
commit bf4d670ef0e3e35ae9fced9555c138689d031776
@@ -2180,7 +2180,7 @@ def runFile(self, event=None):

if sys.platform == 'win32':
# the quotes allow file paths with spaces
command = '%s -u %s' % (sys.executable, fullPath)
command = [sys.executable, '-u', fullPath]
# self.scriptProcessID = wx.Execute(command, wx.EXEC_ASYNC,
# self.scriptProcess)
if hasattr(wx, "EXEC_NOHIDE"):
@@ -2193,7 +2193,7 @@ def runFile(self, event=None):
# for unix this signifies a space in a filename
pythonExec = sys.executable.replace(' ', '\ ')
# the quotes would break a unix system command
command = '%s -u %s' % (pythonExec, fullPath)
command = [pythonExec, '-u', fullPath]
_opts = wx.EXEC_ASYNC | wx.EXEC_MAKE_GROUP_LEADER
# update app controls
self.toolbar.EnableTool(self.bldrBtnRun.Id, False)
@@ -2202,7 +2202,7 @@ def runFile(self, event=None):
# the whileRunning method will check on stdout from the script
self._processEndTime = None
self.scriptProcess = subprocess.Popen(
args=command.split(),
args=command,
bufsize=1, executable=None, stdin=None,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=None,
shell=False, cwd=None, env=None,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.