Fix JSON parse error on PHP warnings

Redirect PHP warnings to stderr instead of stdout so that the JSON
doesn't become invalid if there are PHP warnings.
This commit is contained in:
Jakob Lechner 2024-10-23 10:28:41 +02:00
parent c5d7c0e916
commit aa79e9a295

View file

@ -28,20 +28,19 @@ def get_db_connecition_from_typo3_config(ssh_host, ssh_user, config_file):
"--",
"php",
"-d",
"display_errors=1",
"display_errors=stderr",
"--",
config_file,
],
check=True,
input=php_code,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stderr=sys.stderr,
text=True,
)
except subprocess.CalledProcessError as e:
print(f"Error: Command failed with return code {e.returncode}")
print(f"stdout: {e.stdout}")
print(f"stderr: {e.stderr}")
raise
return json.loads(proc.stdout)