Skip to content

Commit

Permalink
Fixed bug with ctl+c disconnecting session
Browse files Browse the repository at this point in the history
  • Loading branch information
null93 committed Jun 26, 2024
1 parent b3489c4 commit a1fb741
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"os/exec"
"time"
"syscall"
"os"

"github.com/null93/aws-knox/sdk/credentials"
"github.com/null93/aws-knox/sdk/picker"
Expand Down Expand Up @@ -165,13 +167,15 @@ var connectCmd = &cobra.Command{
fmt.Sprintf(`{"Target": "%s"}`, connectInstanceId),
fmt.Sprintf("https://ssm.%s.amazonaws.com", role.Region),
)
command.Stdin = cmd.InOrStdin()
command.Stdout = cmd.OutOrStdout()
command.Stderr = cmd.ErrOrStderr()
command.Stdin = os.Stdin
command.Stdout = os.Stdout
command.Stderr = os.Stderr
command.SysProcAttr = &syscall.SysProcAttr{ Setpgid: true, Foreground: true }
err = command.Run()
if err != nil {
ExitWithError(20, "failed to run session-manager-plugin", err)
}
fmt.Println ("EXITED")
},
}

Expand Down

0 comments on commit a1fb741

Please sign in to comment.