npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Why does the CLI override process.title?

Originally posted here; reposting in #bugs in hopes of getting a reply.

What I Wanted to Do

I want to see the exact command that npm was invoked with when I run ps.

What Happened Instead

In the npm CLI, process.title is set to 'npm' .

This has the potential advantage of cleaning up the output of ps or pgrep , but it has the downside of hiding the arguments that the CLI was invoked with.

Reproduction Steps


I discovered this because I use a tmux plugin called “resurrect” that is able to save and restore tmux sessions. It is able to automatically restart running programs for you, but specifically mentions not being able to restart npm because its arguments are not available in the output of ps .

Why does the CLI override process.title ? Would the CLI team be open to removing the override?

Platform Info

This affects all platforms, but here is my information anyways:

$ npm --versions
  npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.3',
  modules: '72',
  napi: '4',
  nghttp2: '1.38.0',
  node: '12.4.0',
  openssl: '1.1.1b',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.29.1',
  v8: '',
  zlib: '1.2.11'
$ node -p process.platform

Well, I’ll give you a reply. Does not sounds like a bug as such. :slight_smile:

You could reformat for #ideas , which stay around and people can comment on and upvote. Your original post did not get any reactions though, so I think probably not affecting many people.