Реализовать lab2: PostgreSQL и постоянные Bearer-сессии
Skeleton contracts / contracts (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
"""Save real command output, preserving the exit code. Do not use with secret-printing commands."""
|
||||
import datetime,subprocess,sys
|
||||
from pathlib import Path
|
||||
if len(sys.argv)<4 or sys.argv[2]!='--':
|
||||
raise SystemExit('Usage: python3 scripts/capture.py evidence/name.txt -- command args...')
|
||||
command=sys.argv[3:]
|
||||
p=subprocess.run(command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
text='UTC: '+datetime.datetime.now(datetime.timezone.utc).isoformat()+'\nCommand: '+' '.join(command)+'\n'+p.stdout+'\nExit code: '+str(p.returncode)+'\n'
|
||||
Path(sys.argv[1]).write_text(text)
|
||||
print(text,end='')
|
||||
raise SystemExit(p.returncode)
|
||||
Reference in New Issue
Block a user