You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried making a simple example program using dune-rpc-lwt and get an error I don't understand when control reaches the end of the function passed to Dune_rpc_lwt.V1.Client.connect. This might be user error on my part but if that's the case I think we should improve the error message or docs or api to make it clearer what I'm doing wrong.
It connects to a dune rpc server, queries the build dir path which it then prints out, before exiting.
The code is:
moduleDrpc_lwt=Dune_rpc_lwt.V1moduleDrpc=Dune_rpc.V1let build_dir ="_build"let()=let init =Drpc.Initialize.create ~id:(Drpc.Id.make (Csexp.Atom"hello")) inlet where =Drpc_lwt.Where.default ~build_dir()in
print_endline
(Printf.sprintf "Connecting to server: %s"
(Dune_rpc_private.Where.to_string where));
Lwt_main.run
(letopenLwt.SyntaxinletopenLwt.Infixinlet* input_channel, output_channel =Drpc_lwt.connect_chan where inDrpc_lwt.Client.connect (input_channel, output_channel) init
~f:(funclient ->
print_endline "client is running";
let* request =Drpc_lwt.Client.Versioned.prepare_request client
Drpc.Request.build_dir
>|=Result.get_ok
inlet* response =Drpc_lwt.Client.request client request ()>|=Result.get_ok
in
print_endline
(Printf.sprintf "path is: %s" (Drpc.Path.to_string_absolute response));
Lwt.return_unit))
If I have dune build -w running in the background then run this program I expect it to connect to the RPC server, print out the build dir, then exit.
Actual Behavior
It connects to the server and prints the build dir, but then raises an exception Unix.Unix_error(Unix.EBADF, "check_descriptor", "").
Full output is:
$ OCAMLRUNPARAM=b _build/default/hello_rpc.exe
Connecting to server: unix:path=_build/.rpc/dune
client is running
path is: _build
Fatal error: exception Unix.Unix_error(Unix.EBADF, "check_descriptor", "")
Raised at Lwt_unix.check_descriptor in file "src/unix/lwt_unix.cppo.ml", line 379, characters 4-64
Called from Lwt_unix.blocking in file "src/unix/lwt_unix.cppo.ml", line 384, characters 2-21
Called from Lwt_unix.read_bigarray in file "src/unix/lwt_unix.cppo.ml", line 682, characters 4-15
Called from Lwt_io.perform_io in file "src/unix/lwt_io.ml", line 236, characters 10-35
Called from Lwt_io.Primitives.read_char in file "src/unix/lwt_io.ml", line 676, characters 6-15
Called from Lwt_io.Primitives.read_char_opt.(fun) in file "src/unix/lwt_io.ml", line 686, characters 17-29
Called from Lwt.Sequential_composition.catch in file "src/core/lwt.ml", line 2008, characters 16-20
Re-raised at Lwt.Miscellaneous.poll in file "src/core/lwt.ml", line 3077, characters 20-29
Called from Lwt_main.run.run_loop in file "src/unix/lwt_main.ml", line 31, characters 10-20
Called from Lwt_main.run in file "src/unix/lwt_main.ml", line 118, characters 8-13
Re-raised at Lwt_main.run in file "src/unix/lwt_main.ml", line 124, characters 4-13
Called from Dune__exe__Hello_rpc in file "hello_rpc.ml", line 12, characters 2-663
I tried making a simple example program using
dune-rpc-lwt
and get an error I don't understand when control reaches the end of the function passed toDune_rpc_lwt.V1.Client.connect
. This might be user error on my part but if that's the case I think we should improve the error message or docs or api to make it clearer what I'm doing wrong.Expected Behavior
See the example project here: https://github.com/gridbugs/hello-dune-rpc
It connects to a dune rpc server, queries the build dir path which it then prints out, before exiting.
The code is:
If I have
dune build -w
running in the background then run this program I expect it to connect to the RPC server, print out the build dir, then exit.Actual Behavior
It connects to the server and prints the build dir, but then raises an exception
Unix.Unix_error(Unix.EBADF, "check_descriptor", "")
.Full output is:
Reproduction
See instructions in example project (https://github.com/gridbugs/hello-dune-rpc)
Specifications
dune
(output ofdune --version
): 3.7.0ocaml
(output ofocamlc --version
): 5.0.0The text was updated successfully, but these errors were encountered: