con / duct

A helper to run a command, capture stdout/stderr and details about running
MIT License
1 stars 1 forks source link

Add option `--clobber` and by default error out if there is already report(s) at the location #23

Closed yarikoptic closed 2 weeks ago

yarikoptic commented 1 month ago
  1. ATM it causes inconsistent behavior overall by default - appends to .json and overwrites outputs files

  2. note and fix also -- no new line is recorded in that .json after final entry -- should be ended with a newline IMHO)

smaug:/tmp
$> rm duct-out*          
(dev3) 3 12170.....................................:Mon 06 May 2024 08:48:03 AM EDT:.
smaug:/tmp
$> duct -p duct-out_ -- bash -c "echo std output; echo 'err output' >&2"         
err output
std output
{"Command": "bash", "System": {"uid": "yoh", "memory_total": 135060111360, "cpu_total": 16}, "ENV": [{}], "GPU": []}
(dev3) 3 12171.....................................:Mon 06 May 2024 08:48:17 AM EDT:.
smaug:/tmp
$> grep o duct-out_*
duct-out_info.json:{"Command": "bash", "System": {"uid": "yoh", "memory_total": 135060111360, "cpu_total": 16}, "ENV": [{}], "GPU": []}
duct-out_stderr:err output
duct-out_stdout:std output
(dev3) 3 12172.....................................:Mon 06 May 2024 08:48:29 AM EDT:.
smaug:/tmp
$> duct -p duct-out_ -- bash -c "echo std output2; echo 'err output2' >&2"
err output2
std output2
{"Command": "bash", "System": {"uid": "yoh", "memory_total": 135060111360, "cpu_total": 16}, "ENV": [{}], "GPU": []}
(dev3) 3 12173.....................................:Mon 06 May 2024 08:48:36 AM EDT:.
smaug:/tmp
$> grep o duct-out_*                                                      
duct-out_info.json:{"Command": "bash", "System": {"uid": "yoh", "memory_total": 135060111360, "cpu_total": 16}, "ENV": [{}], "GPU": []}{"Command": "bash", "System": {"uid": "yoh", 
"memory_total": 135060111360, "cpu_total": 16}, "ENV": [{}], "GPU": []}
duct-out_stderr:err output2
duct-out_stdout:std output2