Hyper: env is a mess

Created on 15 Jul 2016  ·  13Comments  ·  Source: vercel/hyper

Ubuntu 16.04

It's important to keep the environment clean especially in a terminal.

~
❯ env | grep npm_
npm_package_eslintConfig_rules_semi_0=2
npm_config_dry_run=
npm_config_save_dev=
npm_package_eslintConfig_rules_semi_spacing_1_after=true
npm_package_dependencies_electron_config=0.2.0
npm_config_legacy_bundling=
npm_package_eslintConfig_rules_semi_1=always
npm_package_gitHead=483ad67182ee9727f0981ec9ac0e000aa84b4be3
npm_config_viewer=man
npm_config_browser=
npm_config_only=
npm_config_also=
npm_package_eslintConfig_rules_yoda=0
npm_config_rollback=true
npm_config_usage=
npm_package_homepage=https://github.com/zeit/hyperterm#readme
npm_package_dependencies_child_pty=3.0.1
npm_config_globalignorefile=/home/daniel/.npm-packages/etc/npmignore
npm_package_dependencies_gaze=1.1.0
npm_config_maxsockets=50
npm_package_devDependencies_electron_packager=7.1.0
npm_config_shell=bash
npm_config_init_author_url=
npm_config_parseable=
npm_config_shrinkwrap=true
npm_package_devDependencies_eslint_config_standard=5.3.1
npm_package_scripts_lint=eslint *.js
npm_config_init_license=ISC
npm_config_if_present=
npm_package_dependencies_default_shell=1.0.1
npm_config_init_author_email=
npm_package_eslintConfig_rules_no_unused_vars=2
npm_config_cache_max=Infinity
npm_config_sign_git_tag=
npm_config_git_tag_version=true
npm_config_long=
npm_config_cert=
npm_config_local_address=
npm_config_npat=
npm_config_registry=https://registry.npmjs.org/
npm_config_fetch_retries=2
npm_package_repository_url=git+https://github.com/zeit/hyperterm.git
npm_config_message=%s
npm_config_versions=
npm_package_readmeFilename=README.md
npm_config_key=
npm_package_description=HTML/JS/CSS Terminal
npm_package_license=MIT
npm_config_globalconfig=/home/daniel/.npm-packages/etc/npmrc
npm_config_always_auth=
npm_package_eslintConfig_extends=standard
npm_package_devDependencies_eslint=2.13.1
npm_config_cache_lock_retries=10
npm_execpath=/home/daniel/.npm-packages/lib/node_modules/npm/bin/npm-cli.js
npm_config_global_style=
npm_config_cafile=
npm_config_heading=npm
npm_config_proprietary_attribs=true
npm_config_fetch_retry_mintimeout=10000
npm_config_json=
npm_config_argv={"remain":[],"cooked":["start"],"original":["start"]}
npm_config_access=
npm_config_https_proxy=
npm_config_engine_strict=
npm_config_description=true
npm_config_init_module=/home/daniel/.npm-init.js
npm_config_userconfig=/home/daniel/.npmrc
npm_package_devDependencies_eslint_plugin_standard=1.3.2
npm_config_node_version=5.10.0
npm_config_user=1000
npm_package_bugs_url=https://github.com/zeit/hyperterm/issues
npm_lifecycle_event=start
npm_config_save=
npm_package_repository_type=git
npm_package_name=hyperterm
npm_config_editor=vi
npm_config_tag=latest
npm_package_dependencies_ms=0.7.1
npm_config_global=
npm_package_scripts_start=electron index
npm_config_progress=true
npm_config_optional=true
npm_package_eslintConfig_rules_semi_spacing_1_before=false
npm_config_force=
npm_config_bin_links=true
npm_config_searchopts=
npm_package_eslintConfig_rules_no_extra_semi=2
npm_config_depth=Infinity
npm_package_dependencies_electron_is_dev=0.1.1
npm_package_version=0.4.5
npm_config_searchsort=name
npm_config_rebuild_bundle=true
npm_config_unicode=true
npm_config_fetch_retry_maxtimeout=60000
npm_config_save_prefix=^
npm_config_strict_ssl=true
npm_config_ca=
npm_config_loglevel=warn
npm_package_productName=HyperTerm
npm_config_tag_version_prefix=v
npm_config_group=1000
npm_config_dev=
npm_config_save_exact=
npm_config_fetch_retry_factor=10
npm_package_devDependencies_eslint_plugin_promise=1.3.2
npm_config_version=
npm_config_cache_lock_stale=60000
npm_package_dependencies_uid2=0.0.3
npm_config_cache_min=10
npm_config_searchexclude=
npm_config_cache=/home/daniel/.npm
npm_lifecycle_script=electron index
npm_config_color=true
npm_config_proxy=
npm_package_dependencies_mkdirp=0.5.1
npm_config_save_optional=
npm_package_devDependencies_electron_prebuilt=1.2.5
npm_config_ignore_scripts=
npm_config_user_agent=npm/3.8.5 node/v5.10.0 linux x64
npm_config_cache_lock_wait=10000
npm_config_production=
npm_package_dependencies_convert_css_color_name_to_hex=0.1.1
npm_package_eslintConfig_rules_semi_spacing_0=2
npm_config_save_bundle=
npm_config_umask=0002
npm_config_init_version=1.0.0
npm_config_git=git
npm_config_scope=
npm_config_init_author_name=
npm_config_unsafe_perm=true
npm_config_onload_script=
npm_config_tmp=/tmp
npm_config_link=
npm_config_prefix=/home/daniel/.npm-packages
npm_node_execpath=/usr/local/bin/node

Most helpful comment

my non dev build has a clean env

All 13 comments

+1

A terminal shouldn't leak any variables into the environment (or, if it does, it should an intentional, useful feature).

This may only impact the developer build, not sure.

my non dev build has a clean env

Yes, that's how mac apps work. When launched in the console, they are started by the user and all environment variables get passed to the app.

This isn't the case if you double click on the app itself.

@marcbachmann but I launched it from my terminal which has a clean environment, I'm pretty sure this doesn't happen on other Electron apps.

To verify whether this is also the case, please start the app using double click and paste that in the dev tool console: require('electron').remote.process.env

All the variables you've shown get set by npm when you execute npm start. They set all the values of the package.json as env variables. Nothing we can/should do here. That only happens in development.

Sorry. I might have understood that wrong. We can fix it. But it's only in development.

We can try to explicitly set it in https://github.com/marcbachmann/hyperterm/blame/master/session.js#L27

But that might not be worth the trouble.

      env: {
        USER: process.env.USER,
        SHELL: process.env.SHELL,
        PATH: process.env.PATH,
        TERM: 'xterm-256color'
      }

🤔
screen shot 2016-07-26 at 4 17 30 pm

Can confirm with the .deb package that it's only a dev-build issue on Linux too.

Just a note: it seems like this is just the stock npm variables from npm run. That's not really something Hyperterm controls, and would only ever affect the development setup.

Agreed this is just a dev build issue, so closing.

@Tyriar It might have to do with how you're starting the app; if you start it with node_modules/.bin/electron app instead of npm start, I'm willing to bet you get a clean environment. (see the npm-scripts docs)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cilice picture cilice  ·  3Comments

aem picture aem  ·  3Comments

sarneeh picture sarneeh  ·  3Comments

hxnt picture hxnt  ·  3Comments

juicygoose picture juicygoose  ·  3Comments