Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

.bashrc exports in terminal title #14401

Closed
1 of 4 tasks
ariutta opened this issue Oct 24, 2016 · 3 comments
Closed
1 of 4 tasks

.bashrc exports in terminal title #14401

ariutta opened this issue Oct 24, 2016 · 3 comments

Comments

@ariutta
Copy link

ariutta commented Oct 24, 2016

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

In Terminal.app Version 2.7 (377), npm run <MY_SCRIPT_NAME> displays exports from .bashrc in the Terminal title, as illustrated for DUMMY_KEY below:

npm-export-title-bug

This is undesirable, because these could be private API keys.

How can the CLI team reproduce the problem?

In ~/.bashrc, add the line export DUMMY_KEY=nkvjaSDJKVLnsD21l3rn2j.

Create a new npm project that has this script entry:

{
  "scripts": {
    "hello": "echo hello && sleep 10 && echo bye"
  }
}

Run that script: npm run hello.

During the sleep 10 section, you should be able to see DUMMY_KEY in the title. This happens for any long-running command.

supporting information:

  • npm -v prints: 3.10.6
  • node -v prints: v6.8.1
  • npm config get registry prints: https://registry.npmjs.org/
  • Windows, OS X/macOS, or Linux?: macOS Sierra Version 10.12 (16A323)

There was no npm-debug.log generated.

I have tried the following:

  • Disable powerline: no change
  • Just run echo hello && sleep 10 && echo bye (not using npm): keys not shown
@iarna
Copy link
Contributor

iarna commented Oct 25, 2016

FWIW this happens with Terminal 2.6.1 too, with every version of npm and as best as I can tell every version of Node.js.

It does not do this with this rough reproduction of how npm runs lifecycles:

var spawn = require('child_process').spawn
spawn('sh', ['-c', 'echo hello && sleep 10 && echo bye'], {stdio: [0,1,2]})
  .on('error', console.error)
  .on('data', function () { console.log('complete') })

@iarna
Copy link
Contributor

iarna commented Oct 25, 2016

Also FWIW it doesn't happen in iTerm2.

This seems to be related to Terminal's "display command arguments in titlebar feature" but I'm at a loss for how we're making it go haywire.

You can get rid of this display by going to:

Preferences→Profiles→Window

And unchecking "Arguments" which is in the title section just below "Active process name".

@npm-robot
Copy link

We're closing this support issue as it has gone three days without activity. The npm CLI team itself does not provide support via this issue tracker, but we are happy when users help each other here. In our experience once a support issue goes dormant it's unlikely to get further activity. If you're still having problems, you may be better served by joining package.community and asking your question there.

For more information about our new issue aging policies and why we've instituted them please see our blog post.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants