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

v1.2.2 regression for windows service #354

Open
adam-mateen opened this issue Nov 16, 2022 · 1 comment
Open

v1.2.2 regression for windows service #354

adam-mateen opened this issue Nov 16, 2022 · 1 comment

Comments

@adam-mateen
Copy link

adam-mateen commented Nov 16, 2022

My windows service works with v1.2.1, but not v1.2.2.
Using v.1.2.2 the "Start-Service" command in powershell will timeout with a. generic failure:

Start-Service : Service 'FooService (foo_service)' cannot be started due to the following
error: Cannot start service foo_service on computer '.'.

This is because this commit:
380dcf8
causes a regression.

With v1.2.1 my program can start a "windows service" running process A.
process A then immediately runs cmd := exec.Command() and cmd.CombinedOutput() to start process B.

In v.1.2.1 process B was considered NOT INTERACTIVE, and so it could run this code:

	svcConfig := &service.Config{
		Name:        "GoServiceExampleSimple",
		DisplayName: "Go Service Example",
		Description: "This is an example Go service.",
	}

	prg := &program{}
	s, err := service.New(prg, svcConfig)
	if err != nil {
		log.Fatal(err)
	}
	logger, err = s.Logger(nil)
	if err != nil {
		log.Fatal(err)
	}
	err = s.Run()
	if err != nil {
		logger.Error(err)
	}

However, in 1.2.2 process B is labeled INTERACTIVE, which is incorrect.

Basically a process can be NON-INTERACTIVE, but not a WINDOWS SERVICE.
So the commit above is incorrect.

@kardianos
Copy link
Owner

This is unfortunate. I'm not sure what the best solution is, though I recognize that this is a breaking change for you. I'll look into various implementations a bit more.

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

2 participants