forked from LBRYCommunity/lbry-sdk
fixed issue with shell parsing on Windows
This commit is contained in:
parent
17d87eb157
commit
d7c16e161a
1 changed files with 4 additions and 5 deletions
|
@ -3,6 +3,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -35,13 +36,11 @@ class VideoFileAnalyzer:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _execute(command, environment):
|
def _execute(command, environment):
|
||||||
args = shlex.split(command)
|
# log.debug("Executing: %s", command)
|
||||||
|
|
||||||
# if log.isEnabledFor(logging.DEBUG):
|
|
||||||
# log.debug("Executing: %s", " ".join(args))
|
|
||||||
try:
|
try:
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment
|
shlex.split(command) if platform.system() != 'Windows' else command,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment
|
||||||
) as process:
|
) as process:
|
||||||
(stdout, stderr) = process.communicate() # blocks until the process exits
|
(stdout, stderr) = process.communicate() # blocks until the process exits
|
||||||
return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode
|
return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode
|
||||||
|
|
Loading…
Reference in a new issue