Skip to content

Commit ccc419c

Browse files
committed
Support sending log messages to stderr by setting AWS_SSM_QUIET=true
Signed-off-by: Chance Zibolski <[email protected]>
1 parent 3b753c7 commit ccc419c

File tree

1 file changed

+9
-1
lines changed
  • src/sessionmanagerplugin-main

1 file changed

+9
-1
lines changed

src/sessionmanagerplugin-main/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ import (
2222
_ "github.com/aws/session-manager-plugin/src/sessionmanagerplugin/session/shellsession"
2323
)
2424

25+
var out = os.Stdout
26+
27+
func init() {
28+
if quietStr := os.Getenv("AWS_SSM_QUIET"); quietStr == "true" || quietStr == "1" {
29+
out = os.Stderr
30+
}
31+
}
32+
2533
func main() {
26-
session.ValidateInputAndStartSession(os.Args, os.Stdout)
34+
session.ValidateInputAndStartSession(os.Args, out)
2735
}

0 commit comments

Comments
 (0)