con / duct

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

somehow adds 0d character into output dumps #25

Closed yarikoptic closed 1 month ago

yarikoptic commented 1 month ago

I have noticed that after running

$> 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": []}

I could not grep . those output files!!!

$> grep . 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": []}

although content is there... the culprit is that there is 0d (13) is added for some reason!

$> hexdump -C duct-out_stdout                                             
00000000  73 74 64 20 6f 75 74 70  75 74 32 0d 0a           |std output2..|
0000000d

here is how file should look like (I just echo'ed into the file)

$> hexdump -C duct-out_stdout-manual 
00000000  73 74 64 20 6f 75 74 70  75 74 32 0a              |std output2.|
0000000c
yarikoptic commented 1 month ago

does #29 solve this? if so -- please make sure to add there a unittest for that and a Closes #29 statement into PR description. Try to always add such statements -- pretty much every PR should be solving some bugs