(url string, args ...string)
| 123 | } |
| 124 | |
| 125 | func runRemoteShellScript(url string, args ...string) error { |
| 126 | statusCode, script, err := req_helper.HandleRequestWithProxy(url, http.MethodGet, constant.TimeOut20s) |
| 127 | if err != nil { |
| 128 | return err |
| 129 | } |
| 130 | if statusCode < http.StatusOK || statusCode >= http.StatusMultipleChoices { |
| 131 | return fmt.Errorf("download script failed, status code: %d", statusCode) |
| 132 | } |
| 133 | _, err = cmd.NewCommandMgr().RunPipeToFile(os.DevNull, cmd.PipeCommand{ |
| 134 | Name: "sh", |
| 135 | Args: append([]string{"-s"}, args...), |
| 136 | Stdin: bytes.NewReader(script), |
| 137 | }) |
| 138 | return err |
| 139 | } |
no test coverage detected