diff --git a/src/please.go b/src/please.go index 60980e5d3d..c9c7b5bef1 100644 --- a/src/please.go +++ b/src/please.go @@ -1209,7 +1209,15 @@ type TargetsOrArgs []TargetOrArg func (l TargetsOrArgs) Separate() (annotated []core.AnnotatedOutputLabel, unannotated []core.BuildLabel, args []string) { for _, arg := range l { if l, _ := arg.label.Label(); l.IsEmpty() { - args = append(args, arg.arg) + if arg.arg == "-" { + labels := plz.ReadAndParseStdinLabels() + unannotated = append(unannotated, labels...) + for _, label := range labels { + annotated = append(annotated, core.AnnotatedOutputLabel{BuildLabel: label}) + } + } else { + args = append(args, arg.arg) + } } else { annotated = append(annotated, arg.label) unannotated = append(unannotated, arg.label.BuildLabel) diff --git a/src/plz/plz.go b/src/plz/plz.go index 77595ad204..eef2e010a1 100644 --- a/src/plz/plz.go +++ b/src/plz/plz.go @@ -239,9 +239,7 @@ func ReadStdinLabels(labels []core.BuildLabel) []core.BuildLabel { ret := []core.BuildLabel{} for _, l := range labels { if l == core.BuildLabelStdin { - for s := range flags.ReadStdin() { - ret = append(ret, core.ParseBuildLabels([]string{s})...) - } + ret = append(ret, ReadAndParseStdinLabels()...) } else { ret = append(ret, l) } @@ -249,6 +247,15 @@ func ReadStdinLabels(labels []core.BuildLabel) []core.BuildLabel { return ret } +// ReadAndParseStdinLabels unconditionally reads stdin and parses it into build labels. +func ReadAndParseStdinLabels() []core.BuildLabel { + ret := []core.BuildLabel{} + for s := range flags.ReadStdin() { + ret = append(ret, core.ParseBuildLabels([]string{s})...) + } + return ret +} + // A limiter allows only a certain number of concurrent tasks // TODO(peterebden): We have about four of these now, commonise this somewhere type limiter chan struct{}