@@ -76,10 +76,10 @@ let backend_error name args =
7676 let exnty = Exception. Backend_error (name, args) in
7777 Exception. rpc_of_exnty exnty
7878
79- let backend_backtrace_error name args error =
80- let error = rpc_of_error error |> Jsonrpc. to_string in
79+ let backend_backtrace_error name args backtrace =
80+ let backtrace = rpc_of_backtrace backtrace |> Jsonrpc. to_string in
8181 let open Storage_interface in
82- let exnty = Exception. Backend_error_with_backtrace (name, error :: args) in
82+ let exnty = Exception. Backend_error_with_backtrace (name, backtrace :: args) in
8383 Exception. rpc_of_exnty exnty
8484
8585let missing_uri () =
@@ -118,22 +118,22 @@ let fork_exec_rpc root_dir script_name args response_of_rpc =
118118 >> = fun output ->
119119 begin match output.Process.Output. exit_status with
120120 | Error (`Exit_non_zero code ) ->
121- (* Expect an exception and backtrace on stderr *)
122- begin match Or_error. try_with (fun () -> Jsonrpc. of_string output.Process.Output. stderr ) with
121+ (* Expect an exception and backtrace on stdout *)
122+ begin match Or_error. try_with (fun () -> Jsonrpc. of_string output.Process.Output. stdout ) with
123123 | Error _ ->
124- error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stderr ;
125- return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stderr " ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stderr ]))
124+ error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stdout ;
125+ return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stdout " ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stdout ]))
126126 | Ok response ->
127127 begin match Or_error. try_with (fun () -> error_of_rpc response) with
128128 | Error _ ->
129- error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stderr ;
130- return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stderr " ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stderr ]))
131- | Ok x -> return (Error (backend_backtrace_error " SCRIPT_FAILED " [ script_name; " non-zero exit " ; string_of_int code; output. Process.Output. stdout ] x ))
129+ error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stdout ;
130+ return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stdout " ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stdout ]))
131+ | Ok x -> return (Error (backend_backtrace_error x. code x.params x.backtrace ))
132132 end
133133 end
134134 | Error (`Signal signal ) ->
135135 error " %s/%s caught a signal and failed" root_dir script_name;
136- return (Error (backend_error " SCRIPT_FAILED" [ script_name; " signalled" ; Signal. to_string signal; output.Process.Output. stdout; output.Process.Output. stderr ]))
136+ return (Error (backend_error " SCRIPT_FAILED" [ script_name; " signalled" ; Signal. to_string signal; output.Process.Output. stdout; output.Process.Output. stdout ]))
137137 | Ok () ->
138138
139139 (* Parse the json on stdout *)
0 commit comments