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

Environment Variables not passed to Win32 processes #2312

Closed
johndaintree opened this issue Jul 11, 2017 · 4 comments
Closed

Environment Variables not passed to Win32 processes #2312

johndaintree opened this issue Jul 11, 2017 · 4 comments

Comments

@johndaintree
Copy link

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.15063]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

In order to replace Cygwin/MKS toolkit as a build environment on Windows it's important to be able to run the VS compiler from a bash shell/script. However, it looks like environment variables are not passed to child processes. I've tried a few processes:

johnd@Johnd-PC:~$ echo $TERM $JUNK
xterm-256color JD_JUNK
johnd@Johnd-PC:~$ cmd.exe
Unable to translate current working directory. Using C:\Users\johnd\Desktop
C:\Users\johnd\Desktop>echo %TERM% %JUNK%
%TERM% %JUNK%
C:\Users\johnd\Desktop>exit
johnd@Johnd-PC:~$ echo $TERM $JUNK
xterm-256color JD_JUNK

I'd expect variables set in bash to be visible in the cmd.exe process

johnd@Johnd-PC:/mnt/e/tmp$ export INCLUDE=.
johnd@Johnd-PC:/mnt/e/tmp$ cl.exe -c ./jd.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

jd.c
./jd.c(1): fatal error C1034: jd.h: no include path set

$INCLUDE needs to be passed in the environment to cl.exe

johnd@Johnd-PC:~$ export JUNK=JD_JUNK
johnd@Johnd-PC:~$ notepad

If I then examine the notepad process with sysinternals' "Process Explorerer" I can see that JUNK is not in its environment.

  • What's wrong / what should be happening instead:

So, (as per Linux processes), environment variables should be passed to WIN32 child processes. I appreciate that PATH might need to be translated in some fashion, but I don't think anything else should be (I think it's OK to expect the user to have translated things like $INCLUDE from my example).

@sunjoong
Copy link

@johndaintree - This looks like almost same issue to #1494 and/or #1363.

@johndaintree
Copy link
Author

Right, yes. Sorry. My search criteria weren't strong enough. Should I delete this one?

@sunjoong
Copy link

@johndaintree - Well... You could close this issue by using "close" button, below text area, left "comment" button, or leave it to member of this tracker :)

@johndaintree
Copy link
Author

Closed. T'was a duplicate. (#1494 #1363)

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