-
Notifications
You must be signed in to change notification settings - Fork 301
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
Shell package cleanup #3068
Shell package cleanup #3068
Conversation
fc3548c
to
6f4fa88
Compare
2ca681e
to
9caf9c1
Compare
Using `atomic.Pointer` instead of `sync.Mutex`, and only storing the `process.Process`, since the `process.Config` isn't needed after start.
Add dry run and command log options
Rename and unexport Shell.Writer -> Shell.stdout
Note that RunAndCaptureStdout has a different opinion of what to do with stderr: it is now reflected in the output.
9caf9c1
to
aace2b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing stands out to me, however I think we should run this in the agent and k8s a bit before releasing.
@@ -347,6 +347,10 @@ func (p *Process) Started() <-chan struct{} { | |||
|
|||
// Interrupt the process on platforms that support it, terminate otherwise | |||
func (p *Process) Interrupt() error { | |||
if p == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can call a function on a nil Process
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under the hood p
is just another argument to a function. (*Process)(nil)
still has the type *Process
, so Go will find the method and call it.
I'm going to merge this now rather than later:
|
Description
The
shell
package is going to be used outside the job executor, so it should be moved up one level and also tidied up substantially.Changes
There's a lot happening here so it's in several commits.
Each one is fairly focused on a particular aspect, so shouldn't be too maddening to review.
One thing that's worth calling out: this changes how
RunAndCapture
(now calledRunAndCaptureStdout
, on a different type) handlesstderr
. Previously,stderr
of the process being run was dropped with no way to override it. I think that's not very useful, so I changed the default behaviour to showstderr
(with an override via functional options).Testing
go test ./...
). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...
)