Skip to content

Commit

Permalink
Force shell=True for subprocess call for Linux systems
Browse files Browse the repository at this point in the history
  • Loading branch information
robbmcleod committed Aug 16, 2018
1 parent e88d1a5 commit 34b5f92
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions numexpr/tests/test_numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,20 @@ def test_locals_clears_globals(self):
# if in the top-frame. This cannot be done inside `unittest` as it is always
# executing code in a child frame.
import subprocess
script = ';'.join([
"import numexpr as ne",
"a=10",
"ne.evaluate('1')",
"a += 1",
script = r';'.join([
r"import numexpr as ne",
r"a=10",
r"ne.evaluate('1')",
r"a += 1",
r"ne.evaluate('2', local_dict={})",
"a += 1",
r"a += 1",
r"ne.evaluate('3', global_dict={})",
"a += 1",
r"a += 1",
r"ne.evaluate('4', local_dict={}, global_dict={})",
"a += 1",
r"a += 1",
])
# Raises CalledProcessError on a non-normal exit
check = subprocess.check_call('python -c "{}"'.format(script))
check = subprocess.check_call('python -c "{}"'.format(script), shell=True)

This comment has been minimized.

Copy link
@lgarrison

lgarrison Aug 17, 2018

Contributor

I'm not sure shell=True is required here. I think the problem is that the string needs to be broken up into tokens, like check_call([sys.executable, "-c", script]).

It's probably not too harmful to leave as-is, but I think shell=True is considered slower and less secure.

# Ideally this test should also be done against ipython but it's not
# a requirement.

Expand Down

0 comments on commit 34b5f92

Please sign in to comment.