Skip to content

Commit

Permalink
Notify listening processes when a build starts. (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidANeil authored and achew22 committed May 29, 2019
1 parent 6770465 commit 7d93aa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ibazel/command/notify_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func (c *notifyCommand) NotifyOfChanges() *bytes.Buffer {
b.WriteToStderr(true)
b.WriteToStdout(true)

_, err := c.stdin.Write([]byte("IBAZEL_BUILD_STARTED\n"))
if err != nil {
fmt.Fprintf(os.Stderr, "Error writing build to stdin: %s\n", err)
}

outputBuffer, res := b.Build(c.target)
if res != nil {
fmt.Fprintf(os.Stderr, "FAILURE: %v\n", res)
Expand Down
2 changes: 1 addition & 1 deletion ibazel/command/notify_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestNotifyCommand(t *testing.T) {
}

// Read on the pipe is only valid in between start and wait so read now.
expected := "IBAZEL_BUILD_COMPLETED SUCCESS\nIBAZEL_BUILD_COMPLETED FAILURE\nIBAZEL_BUILD_COMPLETED SUCCESS\n"
expected := "IBAZEL_BUILD_STARTED\nIBAZEL_BUILD_COMPLETED SUCCESS\nIBAZEL_BUILD_STARTED\nIBAZEL_BUILD_COMPLETED FAILURE\nIBAZEL_BUILD_STARTED\nIBAZEL_BUILD_COMPLETED SUCCESS\n"
if expected != string(out) {
t.Errorf("Not equal.\nGot: %s\nWant: %s", string(out), expected)
}
Expand Down

0 comments on commit 7d93aa5

Please sign in to comment.