bugfix: #639 Exec support, disallow URL and similar arguments with

This commit is contained in:
jamesread
2025-10-26 16:40:44 +00:00
parent 1cb12b203e
commit c917d1b1e7
6 changed files with 216 additions and 3 deletions

View File

@@ -21,5 +21,17 @@ func wrapCommandInShell(ctx context.Context, finalParsedCommand string) *exec.Cm
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
return cmd
}
func wrapCommandDirect(ctx context.Context, execArgs []string) *exec.Cmd {
if len(execArgs) == 0 {
return nil
}
cmd := exec.CommandContext(ctx, execArgs[0], execArgs[1:]...)
// This is to ensure that the process group is killed when the parent process is killed.
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
return cmd
}