Merge pull request #811 from tonistiigi/empty-stdin

buildctl: detect empty stdin with empty frontend
This commit is contained in:
Tibor Vass
2019-02-01 20:05:13 -08:00
committed by GitHub

View File

@@ -214,10 +214,16 @@ func build(clicontext *cli.Context) error {
var def *llb.Definition
if clicontext.String("frontend") == "" {
if fi, _ := os.Stdin.Stat(); (fi.Mode() & os.ModeCharDevice) != 0 {
return errors.Errorf("please specify --frontend or pipe LLB definition to stdin")
}
def, err = read(os.Stdin, clicontext)
if err != nil {
return err
}
if len(def.Def) == 0 {
return errors.Errorf("empty definition sent to build. Specify --frontend instead?")
}
} else {
if clicontext.Bool("no-cache") {
solveOpt.FrontendAttrs["no-cache"] = ""