diff --git a/master_changes.md b/master_changes.md index cf2b8c056f7..0d5d0a8848d 100644 --- a/master_changes.md +++ b/master_changes.md @@ -38,6 +38,7 @@ users) * Improve the messages when a package is not up-to-date on opam upgrade [#6272 @kit-ty-kate - fix #6270] * Use a non-underline uppercase character to denotate the default when asking a question [#6289 @hannesm @kit-ty-kate - fix #6288] * Do not pre-write the answer to questions with the default anwser [#6376 @kit-ty-kate] + * Display Windows NTSTATUS exit codes in hex [#6401 @dra27 @MisterDA] ## Switch * [BUG] Fix `opam switch remove ` failure when it is a linked switch [#6276 @btjorge - fix #6275] diff --git a/src/core/opamProcess.ml b/src/core/opamProcess.ml index 2d810728ed2..3f25f52e88c 100644 --- a/src/core/opamProcess.ml +++ b/src/core/opamProcess.ml @@ -842,10 +842,12 @@ let string_of_result ?(color=`yellow) r = Buffer.contents b let result_summary r = - Printf.sprintf "%S exited with code %d%s" + Printf.sprintf "%S exited with code %s%s" (try OpamStd.List.assoc String.equal "command" r.r_info with Not_found -> "command") - r.r_code + (if Sys.win32 && r.r_code < 0 then + Printf.sprintf "0x%08lx" (Int32.of_int r.r_code) + else string_of_int r.r_code) (if r.r_code = 0 then "" else match r.r_stderr, r.r_stdout with | [e], _ | [], [e] -> Printf.sprintf " \"%s\"" e