Subject: Re: Setting env var CYGWIN for Cygwin service?
From: Oleksandr Gavenko via Cygwin <[email-masked]>
To: [email-masked]
Date: Thu, 31 Dec 2020 17:20:03 +0200
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On 2020-12-31, Franz Fehringer via Cygwin wrote:

> Cygwin inherits Windows environment variables, this should be the simplest take.

Normally does, no doubt.

So I made `srv.c`:

  #include <unistd.h>
  int main() {
      sleep(60);
  }

compiled:

  gcc -o srv.exe srv.c

registered:

  cygrunsrv -I mysrv -t manual -p $PWD/srv.exe -c $PWD -e MY=hello -d "My Srv" -f "Testing Cyg Service"

  $ cygrunsrv -L
  exim
  mysrv

launched:

  cygrunsrv --start mysrv

Finally checked with Process Explorer:

* corresponding `cygrunsrv` had many env vars
* my `srv.exe` had only:

>    PATH
>    SYSTEMDRIVE
>    SYSTEMROOT
>    WINDIR

Same was for exim as I wrote earlier. `cygrunsrv` has everything, `exim` only
4 env vars.

  uname -r
  3.1.7(0.340/5/3)

-- 
http://defun.work/

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple