mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove Curl function from future
This commit is contained in:
parent
b5c1cd7991
commit
b0265e0a38
1 changed files with 0 additions and 20 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
"io"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -87,25 +86,6 @@ func Pv(src io.Reader, info io.Writer) io.Reader {
|
|||
return r
|
||||
}
|
||||
|
||||
// Curl makes an http request by executing the unix command 'curl', and returns
|
||||
// the body of the response. If `stderr` is not nil, a progress bar will be
|
||||
// written to it.
|
||||
func Curl(url string, stderr io.Writer) (io.Reader, error) {
|
||||
curl := exec.Command("curl", "-#", "-L", "--fail", url)
|
||||
output, err := curl.StdoutPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
curl.Stderr = stderr
|
||||
if err := curl.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := curl.Wait(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return output, nil
|
||||
}
|
||||
|
||||
// Request a given URL and return an io.Reader
|
||||
func Download(url string, stderr io.Writer) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
|
|
Loading…
Add table
Reference in a new issue