fix: resolve SSH key generation issue (#13027)

This commit is contained in:
ssongliu
2026-06-12 11:17:08 +08:00
committed by GitHub
parent aea71664ee
commit 45c5c5b40f
2 changed files with 2 additions and 32 deletions
+1 -16
View File
@@ -240,7 +240,7 @@ func (c *CommandHelper) pipeContext() (context.Context, context.CancelFunc) {
func (c *CommandHelper) buildPipeCommands(ctx context.Context, commands []PipeCommand) []*exec.Cmd {
cmds := make([]*exec.Cmd, 0, len(commands))
for _, item := range commands {
cmdItem := exec.CommandContext(ctx, item.Name, filterEmptyArgs(item.Args)...)
cmdItem := exec.CommandContext(ctx, item.Name, item.Args...)
cmdItem.Env = append(os.Environ(), c.env...)
cmdItem.Env = append(cmdItem.Env, item.Env...)
cmdItem.Dir = c.workDir
@@ -305,7 +305,6 @@ func (c *CommandHelper) run(name string, arg ...string) (string, error) {
var newContext context.Context
var cancel context.CancelFunc
var outputFile *os.File
arg = filterEmptyArgs(arg)
if c.timeout != 0 {
if c.context == nil {
@@ -412,20 +411,6 @@ func (c *CommandHelper) run(name string, arg ...string) (string, error) {
}
}
func filterEmptyArgs(args []string) []string {
if len(args) == 0 {
return args
}
filtered := args[:0]
for _, arg := range args {
if arg == "" {
continue
}
filtered = append(filtered, arg)
}
return filtered
}
func contextDone(ctx context.Context) <-chan struct{} {
if ctx == nil {
return nil
+1 -16
View File
@@ -219,7 +219,7 @@ func (c *CommandHelper) pipeContext() (context.Context, context.CancelFunc) {
func (c *CommandHelper) buildPipeCommands(ctx context.Context, commands []PipeCommand) []*exec.Cmd {
cmds := make([]*exec.Cmd, 0, len(commands))
for _, item := range commands {
cmdItem := exec.CommandContext(ctx, item.Name, filterEmptyArgs(item.Args)...)
cmdItem := exec.CommandContext(ctx, item.Name, item.Args...)
cmdItem.Env = append(os.Environ(), c.env...)
cmdItem.Env = append(cmdItem.Env, item.Env...)
cmdItem.Dir = c.workDir
@@ -284,7 +284,6 @@ func (c *CommandHelper) run(name string, arg ...string) (string, error) {
var newContext context.Context
var cancel context.CancelFunc
var outputFile *os.File
arg = filterEmptyArgs(arg)
if c.timeout != 0 {
if c.context == nil {
@@ -379,20 +378,6 @@ func (c *CommandHelper) run(name string, arg ...string) (string, error) {
}
}
func filterEmptyArgs(args []string) []string {
if len(args) == 0 {
return args
}
filtered := args[:0]
for _, arg := range args {
if arg == "" {
continue
}
filtered = append(filtered, arg)
}
return filtered
}
func contextDone(ctx context.Context) <-chan struct{} {
if ctx == nil {
return nil