Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create NotifyCommand mode #39

Merged
merged 1 commit into from
Sep 29, 2017
Merged

Create NotifyCommand mode #39

merged 1 commit into from
Sep 29, 2017

Conversation

achew22
Copy link
Member

@achew22 achew22 commented Sep 28, 2017

In this mode the command is notified that the build has completed over
stdin. The program can then intelligently react and decide to reload
dependencies without having to restart.

b := &mock_bazel.MockBazel{}
b.WaitError(nil)
bazelNew = func() bazel.Bazel { return b }
defer func() { bazelNew = oldBazelNew }()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be might lack of go skill talking but it seems like these two lines are the equivelent of writing bazelNew = oldBazelNew. Why defer this function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defer executes a function at the end of the current function. This makes the bazelNew mock get reset after everything is done.

c.NotifyOfChanges()
b.WaitError(nil)
c.NotifyOfChanges()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to expect that isSubprocessRunning to be true at this point

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, turns out that isn't possible to do because I'm using cmd.CombinedOutput which starts the job. I'm going to return it to the old way and work instead on an end to end test which is a better test anyway.

In this mode the command is notified that the build has completed over
stdin. The program can then intelligently react and decide to reload
dependencies without having to restart.
@achew22 achew22 merged commit 1ee0d33 into bazelbuild:master Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants