mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-08 06:04:57 +03:00
Change command used when running on Windows
Before this commit the string version of a command was used when running on Windows. This changes it so the input - string or list of strings - is passed directly. In the case the input was a string, nothing changes. In the case the input was a list, Python will internally build a command string such that each element of the list is quoted correctly for Windows exec call. We can't call that method directly because it's considered an implementation detail, see below. https://bugs.python.org/issue10838 An example of when this behavior is correct is if we build a command line list and sys.executable needs to be quoted because it contains spaces or something. Before this change the arguments would just be joined with a space, which would not work.
This commit is contained in:
parent
edfa32da47
commit
2fe360d7f3
|
@ -974,7 +974,7 @@ def run_command(
|
||||||
cmd_list = command
|
cmd_list = command
|
||||||
cmd_str = " ".join(command)
|
cmd_str = " ".join(command)
|
||||||
try:
|
try:
|
||||||
cmd_to_run = cmd_str if is_windows else cmd_list
|
cmd_to_run = command if is_windows else cmd_list
|
||||||
ret = subprocess.run(
|
ret = subprocess.run(
|
||||||
cmd_to_run,
|
cmd_to_run,
|
||||||
env=os.environ.copy(),
|
env=os.environ.copy(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user