[Spice-devel] [phodav PATCH 4/4] spice-webdavd: Option to run without service on Windows

Marc-André Lureau marcandre.lureau at gmail.com
Thu Feb 25 14:34:10 UTC 2016


Hi

On Thu, Feb 4, 2016 at 2:50 PM, Lukas Venhoda <lvenhoda at redhat.com> wrote:
> Adds --no-service argument.
> This runs the program normally, instead of running as Windows service.
> ---
>  spice/spice-webdavd.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
> index b3fd1ea..f9c5cf1 100644
> --- a/spice/spice-webdavd.c
> +++ b/spice/spice-webdavd.c
> @@ -563,6 +563,10 @@ incoming_callback (GSocketService    *service,
>
>  static int port;
>
> +#ifdef G_OS_WIN32
> +static gboolean no_service;
> +#endif
> +
>  #ifdef WITH_AVAHI
>  static GaClient *mdns_client;
>  static GaEntryGroup *mdns_group;
> @@ -852,6 +856,11 @@ static GOptionEntry entries[] = {
>    { "port", 'p', 0,
>      G_OPTION_ARG_INT, &port,
>      "Port to listen on", NULL },
> +#ifdef G_OS_WIN32
> +  { "no-service", 0, 0,
> +    G_OPTION_ARG_NONE, &no_service,
> +    "Don't start as a service", NULL },
> +#endif
>    { NULL }
>  };
>
> @@ -910,7 +919,7 @@ main (int argc, char *argv[])
>      {
>        { (char *)"spice-webdavd", service_main }, { NULL, NULL }
>      };
> -  if (!getenv("DEBUG"))
> +  if (!no_service && !getenv("DEBUG"))
>      {
>        if (!StartServiceCtrlDispatcher (service_table))
>          {

I would use || instead of &&, so using DEBUG=1 is enough (the
--no-service is mostly for development doc purposes, not really useful
in practice).

> --
> 2.5.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list