Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an exception instead of Failure "execve: Argument list too long" #561

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib_eio/process.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let pp_status ppf = function
type error =
| Executable_not_found of string
| Child_error of exit_status
| Argument_list_too_long

type Exn.err += E of error

Expand All @@ -25,6 +26,7 @@ let () =
begin match e with
| Executable_not_found e -> Fmt.pf f "Executable %S not found" e;
| Child_error e -> Fmt.pf f "Child_error %a" pp_status e;
| Argument_list_too_long -> Fmt.pf f "Argument list too long"
end;
true
| _ -> false
Expand Down
1 change: 1 addition & 0 deletions lib_eio/process.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ val pp_status : [< status] Fmt.t
type error =
| Executable_not_found of string (** The requested executable does not exist. *)
| Child_error of exit_status (** The process exited with an error status. *)
| Argument_list_too_long (** The arguments passed to the process were too large. *)

type Exn.err += E of error

Expand Down
1 change: 1 addition & 0 deletions lib_eio_linux/low_level.ml
Original file line number Diff line number Diff line change
Expand Up @@ -521,5 +521,6 @@ module Process = struct
(* Check for errors starting the process. *)
match read_response errors_r with
| "" -> t (* Success! Execing the child closed [errors_w] and we got EOF. *)
| "execve: Argument list too long" -> raise (Eio.Process.err Eio.Process.Argument_list_too_long)
| err -> failwith err
end
1 change: 1 addition & 0 deletions lib_eio_posix/low_level.ml
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,6 @@ module Process = struct
(* Check for errors starting the process. *)
match read_response errors_r with
| "" -> t (* Success! Execing the child closed [errors_w] and we got EOF. *)
| "execve: Argument list too long" -> raise (Eio.Process.err Eio.Process.Argument_list_too_long)
| err -> failwith err
end