mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/archive: gzDecompress(): use local vars for MOBY_DISABLE_PIGZ
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b321474747
commit
e3491ab56a
1 changed files with 6 additions and 11 deletions
|
@ -143,21 +143,16 @@ func xzDecompress(ctx context.Context, archive io.Reader) (io.ReadCloser, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func gzDecompress(ctx context.Context, buf io.Reader) (io.ReadCloser, error) {
|
func gzDecompress(ctx context.Context, buf io.Reader) (io.ReadCloser, error) {
|
||||||
noPigzEnv := os.Getenv("MOBY_DISABLE_PIGZ")
|
if noPigzEnv := os.Getenv("MOBY_DISABLE_PIGZ"); noPigzEnv != "" {
|
||||||
var noPigz bool
|
noPigz, err := strconv.ParseBool(noPigzEnv)
|
||||||
|
|
||||||
if noPigzEnv != "" {
|
|
||||||
var err error
|
|
||||||
noPigz, err = strconv.ParseBool(noPigzEnv)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Warn("invalid value in MOBY_DISABLE_PIGZ env var")
|
logrus.WithError(err).Warn("invalid value in MOBY_DISABLE_PIGZ env var")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if noPigz {
|
if noPigz {
|
||||||
logrus.Debugf("Use of pigz is disabled due to MOBY_DISABLE_PIGZ=%s", noPigzEnv)
|
logrus.Debugf("Use of pigz is disabled due to MOBY_DISABLE_PIGZ=%s", noPigzEnv)
|
||||||
return gzip.NewReader(buf)
|
return gzip.NewReader(buf)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unpigzPath, err := exec.LookPath("unpigz")
|
unpigzPath, err := exec.LookPath("unpigz")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue