Fix Python 3.5 compat: capture_output and text= not available
Use stdout=PIPE/stderr=PIPE and manual .decode() instead. Use official 1.6.6 gplan.so (built with Stretch-era GCC, no GLIBC_2.29 dep).
This commit is contained in:
@@ -359,13 +359,15 @@ class Hooks:
|
|||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
command, shell=True, env=env,
|
command, shell=True, env=env,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
capture_output=True, text=True
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
)
|
)
|
||||||
|
|
||||||
if result.stdout.strip():
|
stdout = result.stdout.decode('utf-8', errors='replace').strip()
|
||||||
self.log.info('Script stdout: %s' % result.stdout.strip())
|
stderr = result.stderr.decode('utf-8', errors='replace').strip()
|
||||||
|
|
||||||
|
if stdout:
|
||||||
|
self.log.info('Script stdout: %s' % stdout)
|
||||||
|
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
raise Exception('Script failed (%d): %s' %
|
raise Exception('Script failed (%d): %s' %
|
||||||
(result.returncode,
|
(result.returncode, stderr or 'non-zero exit'))
|
||||||
result.stderr.strip() or 'non-zero exit'))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user