Skip to content

Commit 3ff5c34

Browse files
committed
relaxed return type
1 parent eb8fe3e commit 3ff5c34

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib_eio/process.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ let run t ?cwd ?stdin ?stdout ?stderr ?(is_success = Int.equal 0) ?env ?executab
143143

144144
let pipe (type tag) ~sw ((Resource.T (v, ops)) : [> tag mgr_ty] r) =
145145
let module X = (val (Resource.get ops Pi.Mgr)) in
146-
X.pipe v ~sw
146+
let r, w = X.pipe v ~sw in
147+
let r = (r : [Flow.source_ty | Resource.close_ty] r :> [< Flow.source_ty | Resource.close_ty] r) in
148+
let w = (w : [Flow.sink_ty | Resource.close_ty] r :> [< Flow.sink_ty | Resource.close_ty] r) in
149+
r, w
147150

148151
let parse_out (type tag) (t : [> tag mgr_ty] r) parse ?cwd ?stdin ?stderr ?is_success ?env ?executable args =
149152
Switch.run ~name:"Process.parse_out" @@ fun sw ->

lib_eio/process.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ val parse_out :
140140

141141
(** {2 Pipes} *)
142142

143-
val pipe : sw:Switch.t -> _ mgr -> [Flow.source_ty | Resource.close_ty] r * [Flow.sink_ty | Resource.close_ty] r
143+
val pipe : sw:Switch.t -> _ mgr -> [< Flow.source_ty | Resource.close_ty] r * [< Flow.sink_ty | Resource.close_ty] r
144144
(** [pipe ~sw mgr] creates a pipe backed by the OS.
145145
146146
The flows can be used by {!spawn} without the need for extra fibers to copy the data.

0 commit comments

Comments
 (0)