Cli: v2 bug: cli app can not start as Windows service

Created on 18 Dec 2019  路  4Comments  路  Source: urfave/cli

my urfave/cli version is

_v2_

Describe the bug

I create a command line app with cli, everything works fine under normal conditions, but when I use sc to install it as a Windows service, it can not start up because of below error:

Error 1053: The service did not respond to the start or control request in a timely fashion

removecli code and switch to standard flags, everything is ok.

To reproduce

Just create a plain demo with cli, then use sc to install it.

Expected behavior

cli app can run as service in Windows.

arev2 kinbug statutriage

All 4 comments

sc [...] Windows service ... The service did not respond

@navono I'm not sure you reported this to the right Github repo? Can you answer the following questions:

  1. what is sc?
  2. what windows service are you talking about? this is an open source package, there are no services involved here.
  3. what service is returning The service did not respond?
  4. when you say _"when I use sc to install it as a Windows service"_ what is "it" referring to? Our installation instructions state to install our package via go get.

@lynncyrin thank you for response.

  1. what is sc?

It's a build in service tool in Windows, used to manage and control services( Windows service like daemon in Linux).

  1. what windows service are you talking about? this is an open source package, there are no services involved here.

I'm talking about Windows Service that hosted by OS, sort of like systemd in Linux.

  1. what service is returning The service did not respond?

Take systemctl for example, like systemctl start to start the gegistered service, but failed.

  1. when you say "when I use sc to install it as a Windows service" what is "it" referring to? Our installation instructions state to install our package via go get.

Use systemd again for the example, when we say register it as a daemon, it means the application we proived, It's the same on Windows. I guess it's not about the installation of the cli itself, it's how it interacts.

I guess it's not about the installation of the cli itself, it's how it interacts.

What's the command being run to install urfave/cli? eg. what command is sc running?

Can you also give me the following things:

  1. the output of go env for a build that succeeds
  2. the output of go env inside of sc

I've found the cause of the problem. When the app registered as service used by sc, their work dir has been changed to C:\Windows\System32, if any part of program use relative directories, It will fail when service started.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

millken picture millken  路  5Comments

nkprince007 picture nkprince007  路  5Comments

costela picture costela  路  5Comments

genieplus picture genieplus  路  5Comments

costela picture costela  路  3Comments