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

service_unix - error text is not informative #104

Open
sg3des opened this issue Jul 24, 2017 · 0 comments
Open

service_unix - error text is not informative #104

sg3des opened this issue Jul 24, 2017 · 0 comments

Comments

@sg3des
Copy link

sg3des commented Jul 24, 2017

Hello. If the command, example start, failed, in output writed only error code, example: "systemctl" failed: exit status 5 - it is not informative.
On my opinion, in function: service_unix:55 func run, if you want to process stderr buffer, better to use bytes.Buffer instead of StderrPipe:

var buf bytes.Buffer
cmd.Stderr = &buf
[...]
if command == "launchctl" {
	if buf.Len() > 0 {
		return fmt.Errorf("%q failed with stderr: %s", command, buf.String())
	}
}
if err := cmd.Wait(); err != nil {
	return fmt.Errorf("%q failed: %s", command, buf.String())
}

In the error will write a valid output from the service, example for systemctl: Failed to start name.service: Unit name.service not found.

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

No branches or pull requests

1 participant