java - System.getenv() only works properly when debugging IntelliJ plugin -
java - System.getenv() only works properly when debugging IntelliJ plugin -
i'm running intellij 13 (on os x yosemite) , trying go thought plugin working. when debugged application seek find problem is, found reason slave thought that's ran gets environment fine.
normally when trying run involving go
utility, exception thrown. plugin execute commands executing go <args>
environment vars:
runtime rt = runtime.getruntime(); process proc = rt.exec(command, goenv, new file(projectdir));
if alter go
command total path of go
binary, works fine. when debugging however, don't have alter path , still succeeds.
the plugin has action prints out environment calls system.getenv()
gotoolwindow toolwindow = this.getgotoolwindow(project); toolwindow.showandcreate(project); toolwindow.clearconsoleview(); string[] sysenv = gosdkutil.convertenvmaptoarray(system.getenv()); toolwindow.printnormalmessage(string.format("%s -> %s%n", "project dir", projectdir)); (string env : sysenv) { toolwindow.printnormalmessage(string.format("%s%n", env)); }
when running thought normally, outputs:
project dir -> /users/lander/development/downloader shell=/bin/zsh tmpdir=/var/folders/6y/xxqr1vqn6q7c_ttvdgjt7p1w0000gn/t/ __cf_user_text_encoding=0x1f5:0x0:0x0 path=/usr/bin:/bin:/usr/sbin:/sbin xpc_flags=0x0 user=lander home=/users/lander xpc_service_name=com.jetbrains.intellij.43484 logname=lander apple_pubsub_socket_render=/private/tmp/com.apple.launchd.tv9zh4qxk4/render ssh_auth_sock=/private/tmp/com.apple.launchd.bcypknio2v/listeners
and when debugging plugin:
project dir -> /users/lander/ideaprojects/gotest zsh=/users/lander/.oh-my-zsh com.apple.java.jvmmode=client grep_options=--color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn __cf_user_text_encoding=0x1f5:0x0:0x0 goroot=/usr/local/opt/go/libexec xpc_flags=0x0 java_main_class_14389=com.intellij.idea.main logname=lander grep_color=1;32 zsh_tmux_term=screen ssh_auth_sock=/private/tmp/com.apple.launchd.bcypknio2v/listeners oldpwd=/applications/intellij thought 13.app/contents/bin shell=/bin/zsh lc_ctype= tmpdir=/var/folders/6y/xxqr1vqn6q7c_ttvdgjt7p1w0000gn/t/ path=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/users/lander/go/bin versioner_python_version=2.7 gopath=/users/lander/go less=-r user=lander com.apple.java.jvmtask=commandline_manual.java zsh_tmux_autostarted=true pager=less home=/users/lander xpc_service_name=0 apple_pubsub_socket_render=/private/tmp/com.apple.launchd.tv9zh4qxk4/render lscolors=gxfxcxdxbxegedabagacad _zsh_tmux_fixed_config=/users/lander/.oh-my-zsh/plugins/tmux/tmux.extra.conf versioner_python_prefer_32_bit=no
what's reason difference?
according jetbrains employee, because slave instance launched environment given external script that's ran. plugins in parent process should not phone call system.getenv()
, instead utilize environmentutil
.
java osx intellij-idea
Comments
Post a Comment