diff --git a/src/py/bbctrl/Hooks.py b/src/py/bbctrl/Hooks.py index 4911b68..d0853c5 100644 --- a/src/py/bbctrl/Hooks.py +++ b/src/py/bbctrl/Hooks.py @@ -359,13 +359,15 @@ class Hooks: result = subprocess.run( command, shell=True, env=env, timeout=timeout, - capture_output=True, text=True + stdout=subprocess.PIPE, stderr=subprocess.PIPE ) - if result.stdout.strip(): - self.log.info('Script stdout: %s' % result.stdout.strip()) + stdout = result.stdout.decode('utf-8', errors='replace').strip() + stderr = result.stderr.decode('utf-8', errors='replace').strip() + + if stdout: + self.log.info('Script stdout: %s' % stdout) if result.returncode != 0: raise Exception('Script failed (%d): %s' % - (result.returncode, - result.stderr.strip() or 'non-zero exit')) + (result.returncode, stderr or 'non-zero exit'))