Skip to content

Commit

Permalink
fix quoting on arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Apr 8, 2024
1 parent 48cb1f5 commit 480d84d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ let print_usage () =
print_endline
"$ ffmpeg -nostdin -stats -progress - -i input.mp4 out.mp4 2>&1 | ffbar"

let unwords = String.concat " "

let () =
match Sys.argv with
| [||] | [|_|] ->
Expand All @@ -81,7 +83,11 @@ let () =
else
read_output stdin
| args ->
args.(0) <-
"2>&1 /usr/bin/ffmpeg -nostdin -hide_banner -stats -progress -" ;
read_output
(Unix.open_process_in @@ String.concat " " (Array.to_list args))
Array.mapi_inplace
(fun i arg ->
if i = 0 then
"2>&1 /usr/bin/ffmpeg -nostdin -hide_banner -stats -progress -"
else
Filename.quote arg )
args ;
read_output (Unix.open_process_in @@ unwords (Array.to_list args))

0 comments on commit 480d84d

Please sign in to comment.