Skip to content

Commit

Permalink
propagate exit code, fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Apr 9, 2024
1 parent 87c32f4 commit 346d91c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,18 @@ let () =
print_usage ()
else
read_output stdin
| _ :: args ->
read_output @@ Unix.open_process_in
@@ Filename.quote_command "/usr/bin/ffmpeg"
(["-nostdin"; "-hide_banner"; "-stats"; "-progress"; "-"] @ args)
~stdout:"/dev/stdout" ~stderr:"/dev/stdout"
| _ :: args -> (
let chan =
Unix.open_process_in
@@ Filename.quote_command "/usr/bin/ffmpeg"
(["-nostdin"; "-hide_banner"; "-stats"; "-progress"; "-"] @ args)
~stdout:"/dev/stdout" ~stderr:"/dev/stdout"
in
read_output chan ;
print_newline () ;
match Unix.close_process_in chan with
| Unix.WEXITED n ->
Printf.printf "exited with %d\n" n ;
exit n
| Unix.WSIGNALED n -> Printf.printf "signaled with %d\n" n
| Unix.WSTOPPED n -> Printf.printf "stopped with %d\n" n )

0 comments on commit 346d91c

Please sign in to comment.