Skip to content

Commit

Permalink
Merge pull request #6401 from MisterDA/win32-exit-code
Browse files Browse the repository at this point in the history
Display Windows `NTSTATUS` exit codes in hex
  • Loading branch information
rjbou authored Mar 3, 2025
2 parents 892e126 + a7f2b20 commit 4bd1a89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dir>` failure when it is a linked switch [#6276 @btjorge - fix #6275]
Expand Down
6 changes: 4 additions & 2 deletions src/core/opamProcess.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bd1a89

Please sign in to comment.