mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
- Increased timeout from 2 to 5
- Added encoding and errors arguments to check_output(), removed call to decode() - Added subprocess.TimeoutExpired to except tuple
This commit is contained in:
parent
59473608cf
commit
5632d3b8a8
|
@ -78,14 +78,16 @@ def execute(command, env=None, cwd=None, log_errors=False, quiet=False, shell=Fa
|
|||
return stdout.decode(errors="replace").strip()
|
||||
|
||||
|
||||
def read_process_output(command, timeout=2):
|
||||
def read_process_output(command, timeout=5):
|
||||
"""Return the output of a command as a string"""
|
||||
try:
|
||||
return subprocess.check_output(
|
||||
command,
|
||||
timeout=timeout
|
||||
).decode("utf-8", errors="ignore").strip()
|
||||
except (OSError, subprocess.CalledProcessError) as ex:
|
||||
timeout=timeout,
|
||||
encoding="utf-8",
|
||||
errors="ignore"
|
||||
).strip()
|
||||
except (OSError, subprocess.CalledProcessError, subprocess.TimeoutExpired) as ex:
|
||||
logger.error("%s command failed: %s", command, ex)
|
||||
return ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue