question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NativeCommandExitException should display "negative" exit codes in hex, not decimal

See original GitHub issue

Prerequisites

Steps to reproduce

When a native command exits with a “negative” (high-order bit set) exit code, PowerShell 7.4.0-preview.4 displays something like:

NativeCommandExitException: Program "winget.exe" ended with non-zero exit code: -1978335212.

This negative value cannot (really) be made sense of unless you convert it to hex (0x8a150014 in that case).

Expected behavior

NativeCommandExitException: Program "winget.exe" ended with non-zero exit code: 0x8a150014.

Actual behavior

NativeCommandExitException: Program "winget.exe" ended with non-zero exit code: -1978335212.

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.4
PSEdition                      Core
GitCommitId                    7.4.0-preview.4
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Issue Analytics

  • State:open
  • Created 3 months ago
  • Comments:28 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
rkeithhillcommented, Jul 10, 2023

The Engine WG reviewed this issue and agrees with @Luiz-Monad. The message can easily be updated to display the int ExitCode in both decimal and hexadecimal.

2reactions
Luiz-Monadcommented, Jul 9, 2023

There’s no true correct answer for this situation, really.

So I propose:

NativeCommandExitException: Program "winget.exe" ended with non-zero exit code: -1978335212 (0x8a150014).

Why not both ! image

Read more comments on GitHub >

github_iconTop Results From Across the Web

NativeCommandExitException should display "negative ...
NativeCommandExitException should display "negative" exit codes in hex, not decimal #24105 · Summary ...
Read more >
Convert negative signed in error number to standard ...
I have a vague memory of reading about a way to convert error numbers from a format like this -1073740791 to something meaningful....
Read more >
Format Exit Code - Reporting
I would like to display the exit code in a useful way. ... as integer) as hexadecimal and display the converted exit code...
Read more >
Tridion Docs: Converting a negative decimal error number to ...
Open Windows calculator and set it to the programmers view. Select decimal (DEC) and paste the value. Now switch to hexadecimal (HEX) and...
Read more >
How to analyze/translate "exit status" - visual studio
Based on my research, most of exit code is like 0xE0434352 . What's their difference? Hexadecimal or decimal? How can I convert -532462766...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found