Skip to content

Commit

Permalink
fix plz run - and plz exec - when stdin is empty (#2936)
Browse files Browse the repository at this point in the history
* add test for plz run and exec from stdin

---------

Co-authored-by: rgodden <[email protected]>
  • Loading branch information
goddenrich and goddenrich authored Nov 1, 2023
1 parent fe0b151 commit ba47b76
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
14 changes: 11 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Version 17.4.0
--------------
* added --keep_going which continues exhasting tasks from the queue even
on failures. This can be useful if you want to collect all possible errors
in a single please build.
* keep going flag (#2932)
* Fix query somepath when it encounters a cycle (#2893)
* Fix text_file strip (#2895)
it now doesn't strip tabs and \ characters.
* plz run parallel/sequential accepts inline args (#2916)
* use character semantics for length and index operations on strings (#2921)
* Add chr built-in function (#2922)
* Add ord built-in function (#2924)
* Add all commit date formats to supported git_show() format verbs (#2930)
* Fix reduce builtin (#2925)
* Fix issue with completing idents in the language server (#2917)

Version 17.3.1
--------------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.4.0-beta.1
17.4.0-beta.2
12 changes: 12 additions & 0 deletions src/please.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ var buildFunctions = map[string]func() int{
},
"exec.sequential": func() int {
annotated, unannotated, args := opts.Exec.Sequential.Args.Targets.Separate()
if len(unannotated) == 0 {
return 0
}
success, state := runBuild(unannotated, true, false, false)
if !success {
return toExitCode(success, state)
Expand All @@ -566,6 +569,9 @@ var buildFunctions = map[string]func() int{
},
"exec.parallel": func() int {
annotated, unannotated, args := opts.Exec.Parallel.Args.Targets.Separate()
if len(unannotated) == 0 {
return 0
}
success, state := runBuild(unannotated, true, false, false)
if !success {
return toExitCode(success, state)
Expand Down Expand Up @@ -597,6 +603,9 @@ var buildFunctions = map[string]func() int{
},
"run.parallel": func() int {
annotated, unannotated, args := opts.Run.Parallel.PositionalArgs.Targets.Separate()
if len(unannotated) == 0 {
return 0
}
if success, state := runBuild(unannotated, true, false, false); success {
var dir string
if opts.Run.WD != "" {
Expand All @@ -610,6 +619,9 @@ var buildFunctions = map[string]func() int{
},
"run.sequential": func() int {
annotated, unannotated, args := opts.Run.Sequential.PositionalArgs.Targets.Separate()
if len(unannotated) == 0 {
return 0
}
if success, state := runBuild(unannotated, true, false, false); success {
var dir string
if opts.Run.WD != "" {
Expand Down
12 changes: 12 additions & 0 deletions test/exec/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ please_repo_e2e_test(
plz_command = "plz exec parallel //:failure",
repo = "test_repo",
)

please_repo_e2e_test(
name = "exec_stdin_parallel_test",
plz_command = "echo '' | plz exec parallel -",
repo = "test_repo",
)

please_repo_e2e_test(
name = "exec_stdin_sequential_test",
plz_command = "echo '' | plz exec sequential -",
repo = "test_repo",
)
12 changes: 12 additions & 0 deletions test/plz_run/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ please_repo_e2e_test(
repo = "test_repo",
)

please_repo_e2e_test(
name = "std_in_empty_parallel_test",
plz_command = "echo '' | plz run parallel -",
repo = "test_repo",
)

please_repo_e2e_test(
name = "std_in_empty_sequential_test",
plz_command = "echo '' | plz run sequential -",
repo = "test_repo",
)

please_repo_e2e_test(
name = "std_in_sequential_test",
expected_output = {
Expand Down

0 comments on commit ba47b76

Please sign in to comment.