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

Add option to include stderr with stdout for execparser #1129

Merged

Conversation

RebeccaMahany
Copy link
Contributor

We discovered that softwareupdate writes No new software available to stderr instead of stdout, meaning we were unable to actually determine whether the device is up-to-date in the kolide_softwareupdate and kolide_softwareupdate_scan tables. This PR adds an option to the execparser to include stderr in stdout; it accomplishes this the same way that exec's CombinedOutput function works.

Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

good enough

@@ -20,7 +20,7 @@ import (
// 3. It moves the stderr into the return error, if needed.
//
// This is not suitable for high performance work -- it allocates new buffers each time.
func Exec(ctx context.Context, logger log.Logger, timeoutSeconds int, possibleBins []string, args []string) ([]byte, error) {
func Exec(ctx context.Context, logger log.Logger, timeoutSeconds int, possibleBins []string, args []string, includeStderr bool) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Arg list is unweildly, but this seems better than starting the work of moving to functional arguments

@RebeccaMahany RebeccaMahany merged commit 5b82a80 into kolide:main Apr 13, 2023
@RebeccaMahany RebeccaMahany deleted the becca/softwareupdate-capture-stderr branch April 13, 2023 19:28
James-Pickett pushed a commit to seejdev/launcher that referenced this pull request Apr 13, 2023
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