Lwt_io catching exception issue

I’m trying to execute ls on a distant machine using Lwt_process, Lwt_io and Lwt_stream.
The code to read the directory is the following:

  let readdir_aux ~remote dir =
      let cmd = Format.sprintf "ls -1 %s" dir in
      let ssh_cmd = create_ssh_cmd remote cmd in
      let lines =
      Lwt_main.run @@
      (Lwt_stream.to_list lines
      >>= fun lines ->
      List.filter (fun line -> line <> "") lines
      |> Array.of_list |> Lwt.return)

When I run the code with no try-with, I have absolutely no issue:

let () = 
    Sys.readdir_aux ~remote "/tmp/tryme/"
    |> Array.iter (fun x -> Format.printf "-%s\n" x)

But, if I had a try catch to surround the call, it just stops:

let () =
    Sys.readdir_aux ~remote "/tmp/tryme/"
    |> Array.iter (fun x -> Format.printf "-%s\n" x)
with _ -> Format.printf "[OK] Exception readdir@."

Does someone already have this issue ? I can’t see what I missed…

It appears that the error came from the fact, that I didn’t close the process. Closing the process resolved the problem.