Skip to content

fix: improve exit codes for agent/agentssh and cli/ssh #10850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
windows returns 1 on kill
  • Loading branch information
mafredri committed Nov 24, 2023
commit ce50540acf572c8706e6675cc53638f7b757bca4
12 changes: 10 additions & 2 deletions agent/agentssh/agentssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ func TestNewServer_Signal(t *testing.T) {
err = sess.Wait()
exitErr := &ssh.ExitError{}
require.ErrorAs(t, err, &exitErr)
require.Equal(t, 255, exitErr.ExitStatus())
wantCode := 255
if runtime.GOOS == "windows" {
wantCode = 1
}
require.Equal(t, wantCode, exitErr.ExitStatus())
})
t.Run("PTY", func(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -304,7 +308,11 @@ func TestNewServer_Signal(t *testing.T) {
err = sess.Wait()
exitErr := &ssh.ExitError{}
require.ErrorAs(t, err, &exitErr)
require.Equal(t, 255, exitErr.ExitStatus())
wantCode := 255
if runtime.GOOS == "windows" {
wantCode = 1
}
require.Equal(t, wantCode, exitErr.ExitStatus())
})
}

Expand Down