fix: dangerous-exec-command-87 (#6999)
Some checks failed
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 17m1s

Co-authored-by: root <root@ai-guardian-remediation-54f45fdc58-g5zpm>
This commit is contained in:
rahulkhinchi-wq
2025-11-26 20:22:34 +05:30
committed by GitHub
parent 552764d48f
commit a459bba20e

View File

@@ -17,6 +17,7 @@ limitations under the License.
package e2e package e2e
import ( import (
"fmt"
"os" "os"
"os/exec" "os/exec"
"path" "path"
@@ -83,6 +84,9 @@ func asyncExec(cli string) (*gexec.Session, error) {
func LongTimeExecWithEnv(cli string, timeout time.Duration, env []string) (string, error) { func LongTimeExecWithEnv(cli string, timeout time.Duration, env []string) (string, error) {
var output []byte var output []byte
c := strings.Fields(cli) c := strings.Fields(cli)
if len(c) == 0 {
return "", fmt.Errorf("empty command")
}
commandName := path.Join(rudrPath, c[0]) commandName := path.Join(rudrPath, c[0])
command := exec.Command(commandName, c[1:]...) command := exec.Command(commandName, c[1:]...)
command.Env = os.Environ() command.Env = os.Environ()