Closed cdonnellytx closed 3 years ago
@cdonnellytx we could go down the pragmatic route:
diff --git a/src/segment_dotnet.go b/src/segment_dotnet.go
index ac8d3891..96b8133f 100644
--- a/src/segment_dotnet.go
+++ b/src/segment_dotnet.go
@@ -1,5 +1,7 @@
package main
+import "runtime"
+
type dotnet struct {
language *language
}
@@ -19,8 +21,12 @@ func (d *dotnet) string() string {
// Exit codes 145 and 0x80008091 are special indicators that dotnet
// ran, but the current project config settings specify
// use of an SDK that isn't installed.
+ exitCodeWindows := dotnetExitCodeWindows
+ if runtime.GOARCH == "amd64" {
+ exitCodeWindows = int(0x80008091)
+ }
exitCode := d.language.exitCode
- if exitCode == dotnetExitCodeWindows || exitCode == dotnetExitCodeUnix {
+ if exitCode == exitCodeWindows || exitCode == dotnetExitCodeUnix {
return d.language.props.getString(UnsupportedDotnetVersionIcon, "\uf071 ")
}
diff --git a/src/segment_dotnet_test.go b/src/segment_dotnet_test.go
index e13140f6..837372e9 100644
--- a/src/segment_dotnet_test.go
+++ b/src/segment_dotnet_test.go
@@ -1,6 +1,7 @@
package main
import (
+ "runtime"
"testing"
"github.com/stretchr/testify/assert"
@@ -84,11 +85,15 @@ func TestDotnetVersionUnsupported(t *testing.T) {
}
func TestDotnetVersionUnsupportedWindows(t *testing.T) {
+ exitCode := dotnetExitCodeWindows
+ if runtime.GOARCH == "amd64" {
+ exitCode = int(0x80008091)
+ }
expected := "x"
args := &dotnetArgs{
enabled: true,
displayVersion: true,
- exitCode: dotnetExitCodeWindows,
+ exitCode: exitCode,
unsupportedIcon: expected,
}
dotnet := bootStrapDotnetTest(args)
@cdonnellytx had to really only include these from being used on that architecture but seems to compile. That should "in theory" also fix the issue.
Just realized -- you might also want to check for arm64
(either here or as part of #463).
@cdonnellytx I'm doing that when go 1.17 lands which hopefully brings full windows ARM support
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
812 changed the
dotnet.exe
Windows exit code0x80008091
to-2147450735
. Unfortunately the dotnet prompt on 64-bit Windows now fails as theint
type is apparently 64-bit in 64-bit Go.Unfortunately I don't know what the best approach is here. Because the exit code ultimately comes from ProcessState.ExitCode(), which returns an
int
, it means the value will be different whether targeting a 32- or 64-bit architecture, and of course on a 32-bit architecture,int(0x80008091)
returns an overflow error.Environment
Steps to Reproduce
C:\temp\exitcodebug
or other suitable pathcd C:\temp\exitcodebug
Expected behavior:
Actual behavior: