Skip to content

Commit

Permalink
Merge pull request #68 from djs55/remove-cmdliner-dep
Browse files Browse the repository at this point in the history
Update cmdliner in examples
  • Loading branch information
djs55 committed Jun 19, 2022
2 parents 6242f89 + 9afd942 commit 6b90ba4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.1 (2022-06-18)

- Update cmdliner dependency to 1.1

## 3.0.0 (2021-05-15)

- Use new Mirage signatures (#66 from @talex5)
Expand Down
2 changes: 1 addition & 1 deletion hvsock.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"lwt" {>= "3.2.0"}
"logs"
"fmt"
"cmdliner"
"cmdliner" {>= "1.1"}
"sha"
"uri"
"base64" {>= "3.0.0"}
Expand Down
4 changes: 0 additions & 4 deletions lib_test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
(names test fuzz_buffering)
(libraries hvsock hvsock.lwt-unix alcotest logs.fmt)
)
(alias
(name runtest)
(deps test.exe)
(action (run ./test.exe -e -v)))
4 changes: 2 additions & 2 deletions lwt/buffering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ let connect ?(message_size = 8192) ?(buffer_size = 262144) fd =
Mutex.unlock t.read_buffers_m;
if n = 0 then begin
Log.debug (fun f -> f "read_thread read length 0");
Log.err (fun f -> f "Read of length 0 from AF_HVSOCK");
raise End_of_file
end else loop @@ Cstruct.shift remaining n
end in
loop buffer
done
with e ->
Log.err (fun f -> f "Flow read_thread caught: %s" (Printexc.to_string e));
if e <> End_of_file
then Log.err (fun f -> f "Flow read_thread caught: %s" (Printexc.to_string e));
Log.debug (fun f -> f "read_thread read_thread_exit <- true");
Mutex.lock t.read_buffers_m;
t.read_thread_exit <- true;
Expand Down
7 changes: 4 additions & 3 deletions src/hvcat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ let cmd =
`P "To connect to a service in a VM on Linux:";
`P "hvcat hvsock://2:80/";
] in
Term.(pure main $ listen $ echo $ uri $ register),
Term.info "hvcat" ~version:"0.1" ~doc ~man
let t = Term.(const main $ listen $ echo $ uri $ register) in
let info = Cmd.info "hvcat" ~version:"0.1" ~doc ~man in
Cmd.v info t

let () =
let (_: Lwt_unix.signal_handler_id) = Lwt_unix.on_signal Sys.sigint
(fun (_: int) ->
Lwt.wakeup_later sigint_u ();
) in
match Term.eval cmd with `Error _ -> exit 1 | _ -> exit 0
Stdlib.exit @@ Cmd.eval cmd
10 changes: 5 additions & 5 deletions src/sock_stress.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ let main c p i v l =
| Some "hvsock", Some vmid ->
begin match Uuidm.of_string vmid with
| Some vmid ->
Lwt_main.run (client (Hvsock.Af_hyperv.Id vmid) p i l);
`Ok ()
Lwt_main.run (client (Hvsock.Af_hyperv.Id vmid) p i l)
| None ->
Printf.fprintf stderr "Failed to parse VM GUID: %s\n" vmid;
exit 1
Expand Down Expand Up @@ -190,12 +189,13 @@ let cmd =
`P "To connect to a service in a remote partition:";
`P "sock_stress -c hvsock://<vmid>";
] in
Term.(const main $ c $ p $ i $ v $ l),
Term.info "sock_stress" ~version:"%0.1" ~doc ~exits:Term.default_exits ~man
let t = Term.(const main $ c $ p $ i $ v $ l) in
let info = Cmd.info "sock_stress" ~version:"%0.1" ~doc ~exits:Cmd.Exit.defaults ~man in
Cmd.v info t

let () =
let (_: Lwt_unix.signal_handler_id) = Lwt_unix.on_signal Sys.sigint
(fun (_: int) ->
Lwt.wakeup_later sigint_u ();
) in
Term.exit @@ Term.eval cmd
Stdlib.exit @@ Cmd.eval cmd

0 comments on commit 6b90ba4

Please sign in to comment.