fix(media-diff): pass SQL via stdin to avoid newline escaping issues in query_db_media_refs
This commit is contained in:
1 parent
0283fa196a
commit
a17afb4b13
1 file changed
+3
-4
@@ -82,12 +82,11 @@ def query_db_media_refs(tcfg):
|
|||||||
"""
|
"""
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
[
|
[
|
||||||
'docker', 'exec', tcfg['db_container'],
|
'docker', 'exec', '-i', tcfg['db_container'],
|
||||||
'sh', '-ec',
|
'sh', '-ec',
|
||||||
'export PGPASSWORD="${POSTGRES_PASSWORD:-}"; '
|
f'export PGPASSWORD="${{POSTGRES_PASSWORD:-}}"; exec psql -U "{tcfg["db_user"]}" -d "{tcfg["db_name"]}" -At',
|
||||||
f'psql -U "{tcfg["db_user"]}" -d "{tcfg["db_name"]}" -At -c ' + json.dumps(sql),
|
|
||||||
],
|
],
|
||||||
capture_output=True, text=True, timeout=30,
|
input=sql, capture_output=True, text=True, timeout=30,
|
||||||
)
|
)
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise RuntimeError(f'Database media query failed: {proc.stderr.strip()}')
|
raise RuntimeError(f'Database media query failed: {proc.stderr.strip()}')
|
||||||
|
|||||||
Reference in new issue
Block a user