Skip to content

Commit 91440a1

Browse files
author
David Scott
committed
Remove the duplicate path prefix from the logging
Signed-off-by: David Scott <[email protected]>
1 parent bc22e25 commit 91440a1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

main.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,25 @@ let missing_uri () =
8888
let (>>>=) = Deferred.Result.(>>=)
8989

9090
let fork_exec_rpc root_dir script_name args response_of_rpc =
91-
info "%s/%s %s" root_dir script_name (Jsonrpc.to_string args);
91+
info "%s %s" script_name (Jsonrpc.to_string args);
9292
( Sys.is_file ~follow_symlinks:true script_name
9393
>>= function
9494
| `No | `Unknown ->
95-
error "%s/%s is not a file" root_dir script_name;
95+
error "%s is not a file" script_name;
9696
return (Error(backend_error "SCRIPT_MISSING" [ script_name; "Check whether the file exists and has correct permissions" ]))
9797
| `Yes -> return (Ok ())
9898
) >>>= fun () ->
9999
( Unix.access script_name [ `Exec ]
100100
>>= function
101101
| Error exn ->
102-
error "%s/%s is not executable" root_dir script_name;
102+
error "%s is not executable" script_name;
103103
return (Error (backend_error "SCRIPT_NOT_EXECUTABLE" [ script_name; Exn.to_string exn ]))
104104
| Ok () -> return (Ok ())
105105
) >>>= fun () ->
106106
Process.create ~prog:script_name ~args:["--json"] ~working_dir:root_dir ()
107107
>>= function
108108
| Error e ->
109-
error "%s/%s failed: %s" root_dir script_name (Error.to_string_hum e);
109+
error "%s failed: %s" script_name (Error.to_string_hum e);
110110
return (Error(backend_error "SCRIPT_FAILED" [ script_name; Error.to_string_hum e ]))
111111
| Ok p ->
112112
(* Send the request as json on stdin *)
@@ -121,33 +121,33 @@ let fork_exec_rpc root_dir script_name args response_of_rpc =
121121
(* Expect an exception and backtrace on stdout *)
122122
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.stdout;
124+
error "%s failed and printed bad error json: %s" script_name output.Process.Output.stdout;
125125
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.stdout;
129+
error "%s failed and printed bad error json: %s" script_name output.Process.Output.stdout;
130130
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 ]))
131131
| Ok x -> return (Error(backend_backtrace_error x.code x.params x.backtrace))
132132
end
133133
end
134134
| Error (`Signal signal) ->
135-
error "%s/%s caught a signal and failed" root_dir script_name;
135+
error "%s caught a signal and failed" script_name;
136136
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 *)
140140
begin match Or_error.try_with (fun () -> Jsonrpc.of_string output.Process.Output.stdout) with
141141
| Error _ ->
142-
error "%s/%s succeeded but printed bad json: %s" root_dir script_name output.Process.Output.stdout;
142+
error "%s succeeded but printed bad json: %s" script_name output.Process.Output.stdout;
143143
return (Error (backend_error "SCRIPT_FAILED" [ script_name; "bad json on stdout"; output.Process.Output.stdout ]))
144144
| Ok response ->
145145
begin match Or_error.try_with (fun () -> response_of_rpc response) with
146146
| Error _ ->
147-
error "%s/%s succeeded but printed bad json: %s" root_dir script_name output.Process.Output.stdout;
147+
error "%s succeeded but printed bad json: %s" script_name output.Process.Output.stdout;
148148
return (Error (backend_error "SCRIPT_FAILED" [ script_name; "json did not match schema"; output.Process.Output.stdout ]))
149149
| Ok x ->
150-
info "%s/%s succeeded: %s" root_dir script_name output.Process.Output.stdout;
150+
info "%s succeeded: %s" script_name output.Process.Output.stdout;
151151
return (Ok x)
152152
end
153153
end

0 commit comments

Comments
 (0)