From bc971b76bf3871cc5ca2ad2f2f8691c40e8804d9 Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Thu, 25 May 2023 12:14:43 +0200 Subject: [PATCH] Tezt: Keep the standard input of daemons --- tezt/lib_tezos/daemon.ml | 9 ++++++--- tezt/lib_tezos/daemon.mli | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tezt/lib_tezos/daemon.ml b/tezt/lib_tezos/daemon.ml index ba736974afbb..2ad5114bb97f 100644 --- a/tezt/lib_tezos/daemon.ml +++ b/tezt/lib_tezos/daemon.ml @@ -73,6 +73,7 @@ module Make (X : PARAMETERS) = struct type session_status = { process : Process.t; + stdin : Lwt_io.output_channel; session_state : X.session_state; mutable event_loop_promise : unit Lwt.t option; } @@ -319,8 +320,8 @@ module Make (X : PARAMETERS) = struct ("file-descriptor-path://" ^ daemon.event_pipe ^ args_str) env in - let process = - Process.spawn + let process, stdin = + Process.spawn_with_stdin ?runner ~name:daemon.name ~color:daemon.color @@ -331,7 +332,9 @@ module Make (X : PARAMETERS) = struct (* Make sure the daemon status is [Running], otherwise [event_loop_promise] would stop immediately thinking the daemon has been terminated. *) - let running_status = {process; session_state; event_loop_promise = None} in + let running_status = + {process; session_state; stdin; event_loop_promise = None} + in daemon.status <- Running running_status ; let event_loop_promise = let rec event_loop () = diff --git a/tezt/lib_tezos/daemon.mli b/tezt/lib_tezos/daemon.mli index 02a6bb11434d..51fc244a7e2f 100644 --- a/tezt/lib_tezos/daemon.mli +++ b/tezt/lib_tezos/daemon.mli @@ -78,6 +78,7 @@ module Make : functor (X : PARAMETERS) -> sig daemon which would be actually running. *) type session_status = { process : Process.t; + stdin : Lwt_io.output_channel; session_state : X.session_state; mutable event_loop_promise : unit Lwt.t option; } -- GitLab