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

Shell package cleanup #3068

Merged
merged 18 commits into from
Nov 7, 2024
Merged

Shell package cleanup #3068

merged 18 commits into from
Nov 7, 2024

Conversation

DrJosh9000
Copy link
Contributor

@DrJosh9000 DrJosh9000 commented Nov 5, 2024

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 called RunAndCaptureStdout, on a different type) handles stderr. 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 show stderr (with an override via functional options).

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@DrJosh9000 DrJosh9000 force-pushed the pipe-358-shell-refactor branch 12 times, most recently from fc3548c to 6f4fa88 Compare November 6, 2024 01:52
@DrJosh9000 DrJosh9000 changed the title Shell refactor Shell package cleanup Nov 6, 2024
@DrJosh9000 DrJosh9000 force-pushed the pipe-358-shell-refactor branch 10 times, most recently from 2ca681e to 9caf9c1 Compare November 7, 2024 04:15
@DrJosh9000 DrJosh9000 force-pushed the pipe-358-shell-refactor branch from 9caf9c1 to aace2b6 Compare November 7, 2024 04:41
Copy link
Contributor

@wolfeidau wolfeidau left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@DrJosh9000
Copy link
Contributor Author

I'm going to merge this now rather than later:

  • The amount of change overall could make it "fun" to rebase
  • Since we want to run it for a bit longer (good point @wolfeidau)

@DrJosh9000 DrJosh9000 merged commit 18f3148 into main Nov 7, 2024
1 check passed
@DrJosh9000 DrJosh9000 deleted the pipe-358-shell-refactor branch November 7, 2024 06:34
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