Skip to content

Commit

Permalink
Fix: First look whether curl exists or not
Browse files Browse the repository at this point in the history
Signed-off-by: GLVS Kiriti <glvskiriti2003369@gmail.com>
  • Loading branch information
GLVSKiriti authored and poiana committed Apr 3, 2024
1 parent 545c1f4 commit d507f85
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion events/syscall/program_run_with_disallowed_http_proxy_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ var _ = events.Register(
)

func ProgramRunWithDisallowedHttpProxyEnv(h events.Helper) error {
cmd := exec.Command("curl", "http://example.com")
curl, err := exec.LookPath("curl")
if err != nil {
h.Log().Warnf("Curl is needed to launch this action")
return err
}
cmd := exec.Command(curl, "http://example.com")
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "HTTP_PROXY=http://my.http.proxy.com ")
h.Log().Info("executing curl or wget with disallowed HTTP_PROXY environment variable")
Expand Down

0 comments on commit d507f85

Please sign in to comment.