mirror of https://github.com/docker/cli.git
Merge pull request #27901 from ripcurld00d/load_stdin_valid
Validate docker-load receives a tar file
This commit is contained in:
commit
256b9c6011
|
@ -1,6 +1,7 @@
|
||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
@ -49,6 +50,13 @@ func runLoad(dockerCli *command.DockerCli, opts loadOptions) error {
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
input = file
|
input = file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To avoid getting stuck, verify that a tar file is given either in
|
||||||
|
// the input flag or through stdin and if not display an error message and exit.
|
||||||
|
if opts.input == "" && dockerCli.In().IsTerminal() {
|
||||||
|
return fmt.Errorf("requested load from stdin, but stdin is empty")
|
||||||
|
}
|
||||||
|
|
||||||
if !dockerCli.Out().IsTerminal() {
|
if !dockerCli.Out().IsTerminal() {
|
||||||
opts.quiet = true
|
opts.quiet = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue