-
Notifications
You must be signed in to change notification settings - Fork 31
fix: unquote environment variable passed to hook commands #410
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
Changes from 2 commits
5bd98a8
5b2cf70
cc1ce45
228907d
d942d79
5122e45
5eb7472
d2f878b
28ff7f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,7 +57,9 @@ func processExecOpts(opts HookExecOpts) ([]string, []string, []string, error) { | |||||||||||||
| // To avoid removing any environment variables that are set in the current environment, we first set the cmd.Env to the current environment. | ||||||||||||||
| // before adding any new environment variables. | ||||||||||||||
| var cmdEnvVars = os.Environ() | ||||||||||||||
| cmdEnvVars = append(cmdEnvVars, goutils.MapToStringSlice(opts.Env, "")...) | ||||||||||||||
| for name, value := range opts.Env { | ||||||||||||||
| cmdEnvVars = append(cmdEnvVars, name+"="+value) | ||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔭 note: These values are set for both the default and message-boundaries protocols:
slack-cli/internal/hooks/shell.go Lines 56 to 59 in 8056444
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return cmdArgs, cmdArgVars, cmdEnvVars, nil | ||||||||||||||
| } | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ import ( | |
| "github.com/gorilla/websocket" | ||
| "github.com/radovskyb/watcher" | ||
| "github.com/slackapi/slack-cli/internal/config" | ||
| "github.com/slackapi/slack-cli/internal/goutils" | ||
| "github.com/slackapi/slack-cli/internal/hooks" | ||
| "github.com/slackapi/slack-cli/internal/iostreams" | ||
| "github.com/slackapi/slack-cli/internal/pkg/apps" | ||
|
|
@@ -307,7 +306,9 @@ func (r *LocalServer) StartDelegate(ctx context.Context) error { | |
| // To avoid removing any environment variables that are set in the current environment, we first set the cmd.Env to the current environment. | ||
| // before adding any new environment variables. | ||
| var cmdEnvVars = os.Environ() | ||
| cmdEnvVars = append(cmdEnvVars, goutils.MapToStringSlice(sdkManagedConnectionStartHookOpts.Env, "")...) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🏁 note: I understand the 🏆 ramble: This implementation in |
||
| for name, value := range sdkManagedConnectionStartHookOpts.Env { | ||
| cmdEnvVars = append(cmdEnvVars, name+"="+value) | ||
| } | ||
| cmd := sdkManagedConnectionStartHookOpts.Exec.Command(cmdEnvVars, os.Stdout, os.Stderr, nil, cmdArgs[0], cmdArgVars...) | ||
|
|
||
| // Store command reference for lifecycle management | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I think we want to keep it as Batman and Robin (the duo/sidekick to Batman), not Batman and Robinhood (two separate fictional characters).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mwbrooks I didn't want to take from the fun! 😉
I'll follow up with an update to add another example that includes a space elsewhere, which is the intention of initial change I meant!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mwbrooks A favorite LSP is added in 28ff7f1!