这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: only passthrough args to primary tasks #739

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 9 commits into from
Feb 16, 2022
11 changes: 9 additions & 2 deletions cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@ func (c *RunCommand) Run(args []string) int {
}
targetLogger.Debug("task output globs", "outputs", outputs)

passThroughArgs := make([]string, 0, len(args))
for _, target := range ctx.Targets {
if target == task {
passThroughArgs = append(passThroughArgs, runOptions.passThroughArgs...)
}
}

// Hash the task-specific environment variables found in the dependsOnKey in the pipeline
var hashabledEnvVars []string
var hashabledEnvPairs []string
Expand All @@ -458,7 +465,7 @@ func (c *RunCommand) Run(args []string) int {
Hash: pack.Hash,
Task: task,
Outputs: outputs,
PassThruArgs: runOptions.passThroughArgs,
PassThruArgs: passThroughArgs,
HashableEnvPairs: hashabledEnvPairs,
}
hash, err := fs.HashObject(hashable)
Expand Down Expand Up @@ -497,7 +504,7 @@ func (c *RunCommand) Run(args []string) int {

// Setup command execution
argsactual := append([]string{"run"}, task)
argsactual = append(argsactual, runOptions.passThroughArgs...)
argsactual = append(argsactual, passThroughArgs...)
// @TODO: @jaredpalmer fix this hack to get the package manager's name
var cmd *exec.Cmd
if ctx.Backend.Name == "nodejs-berry" {
Expand Down