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

VSCODE cannot get right process.env #72235

Closed
ShenChen93 opened this issue Apr 12, 2019 · 7 comments
Closed

VSCODE cannot get right process.env #72235

ShenChen93 opened this issue Apr 12, 2019 · 7 comments
Assignees
Labels
debt Code quality issues info-needed Issue requires more information from poster workbench-cli VS Code Command line issues

Comments

@ShenChen93
Copy link

ShenChen93 commented Apr 12, 2019

Here might be a related one: #70248

  • VSCode Version: 1.33.1
  • OS Version: mac 10.13.6

Steps to Reproduce:

  1. Inside our plugin extension, we use node module shelljs to detect whether a file exists by using the 'which' fucntion. This function will traverse process.env.path and see if there's a match.
  2. It works well for most of time, excepet a few machines. When we launch vscode from terminal, everything looks good. But when we launch the vscode through dock, it will report that file doesn't exist. So I guess vscode may have problem to access process.env when it was launched by dock.

Code in extension.ts

export async function activate(context: vscode.ExtensionContext) {
    if (!await wasCliInstalled()) {
        return;
    }
   ...........
}

async function wasCliInstalled() {
    if (!shell.which('nameOfTheFile')) {
        const action = ....
        return false;
    }
    return true;
}

Does this issue occur when all extensions are disabled?: Yes/No

@bpasero
Copy link
Member

bpasero commented Apr 16, 2019

lazy env issue?

@jrieken
Copy link
Member

jrieken commented Apr 17, 2019

lazy env issue?

Maybe but very unlikely, it would mean that we start the extension host before having resolved the environment...

@joaomoreno Do you know how @ShenChen-Amazon can measure how long it takes to resolve the env...

@jrieken jrieken added debt Code quality issues info-needed Issue requires more information from poster workbench-cli VS Code Command line issues labels Apr 17, 2019
@ShenChen93
Copy link
Author

Hey guys @bpasero @jrieken ,

Thanks for responding, may I know what thing I can do on my side to provide more info you need?

Thanks,
Shen

@joaomoreno
Copy link
Member

@ShenChen-Amazon If you open the Developer Tools and run getLazyEnv().then(console.log), do you get the expected environment?

@vscodebot vscodebot bot closed this as completed May 27, 2019
@vscodebot
Copy link

vscodebot bot commented May 27, 2019

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@panw
Copy link

panw commented Jun 8, 2019

@ShenChen-Amazon @joaomoreno This is what I get as my output

Apple_PubSub_Socket_Render
:
"/private/tmp/com.apple.launchd.wm54InyDZd/Render"
COMMAND_MODE
:
"unix2003"
HOME
:
"/Users/panwangp"
LOGNAME
:
"panwangp"
PATH
:
"/usr/bin:/bin:/usr/sbin:/sbin"
SHELL
:
"/bin/false"
SSH_AUTH_SOCK
:
"/private/tmp/com.apple.launchd.7nV4nwQt1A/Listeners"
TMPDIR
:
"/var/folders/fq/3z17qknd553grhy5fr3tpfr5twgw4y/T/"
USER
:
"panwangp"
VSCODE_IPC_HOOK
:
"/Users/panwangp/Library/Application Support/Code/1.35.0-main.sock"
VSCODE_LOGS
:
"/Users/panwangp/Library/Application Support/Code/logs/20190607T165827"
VSCODE_NLS_CONFIG
:
"{"locale":"en-us","availableLanguages":{},"_languagePackSupport":true}"
VSCODE_NODE_CACHED_DATA_DIR
:
"/Users/panwangp/Library/Application Support/Code/CachedData/553cfb2c2205db5f15f3ee8395bbd5cf066d357d"
VSCODE_PID
:
"51699"
XPC_FLAGS
:
"0x0"
XPC_SERVICE_NAME
:
"com.apple.xpc.launchd.oneshot.0x10000049.Electron"
__CF_USER_TEXT_ENCODING
: "0x75C7F09E:0x0:0x0"

@sattpat
Copy link

sattpat commented Jun 24, 2019

I ran into the same issue yesterday. Could this ticket be reopened?

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues info-needed Issue requires more information from poster workbench-cli VS Code Command line issues
Projects
None yet
Development

No branches or pull requests

6 participants