Skip to content

Commit

Permalink
Support sending log messages to stderr by setting AWS_SSM_QUIET=true
Browse files Browse the repository at this point in the history
Signed-off-by: Chance Zibolski <[email protected]>
  • Loading branch information
chancez committed Apr 4, 2024
1 parent 3b753c7 commit ccc419c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sessionmanagerplugin-main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ import (
_ "github.com/aws/session-manager-plugin/src/sessionmanagerplugin/session/shellsession"
)

var out = os.Stdout

func init() {
if quietStr := os.Getenv("AWS_SSM_QUIET"); quietStr == "true" || quietStr == "1" {
out = os.Stderr
}
}

func main() {
session.ValidateInputAndStartSession(os.Args, os.Stdout)
session.ValidateInputAndStartSession(os.Args, out)
}

0 comments on commit ccc419c

Please sign in to comment.