Unitech / Unitech/pm2

Colors do not reset correctly

Open
#4,369 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

Colors do not reset properly and affects terminal prompt. This should be easily fixed by just putting a reset at the end of the prompt.

How could we reproduce this issue?

Running pm2 list should cause the prompt to go grey and italic.

Supporting information

terminal screenshot showing color reset issue

$ pm2 report

--- PM2 report ----------------------------------------------------------------
Date                 : Sat Jul 27 2019 18:57:33 GMT+0200 (Central European Summer Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.5.0
node version         : 11.13.0
node path            : /root/.nvm/versions/node/v11.13.0/bin/pm2
argv                 : /root/.nvm/versions/node/v11.13.0/bin/node,/root/.nvm/versions/node/v11.13.0/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 93707min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.5.0
node version         : 11.13.0
node path            : /root/.nvm/versions/node/v11.13.0/bin/pm2
argv                 : /root/.nvm/versions/node/v11.13.0/bin/node,/root/.nvm/versions/node/v11.13.0/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
cpus nb              : 8
freemem              : 25140199424
totalmem             : 31613968384
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────────────────┬────┬─────────┬──────┬───────┬─────────┬─────────┬────────┬───────┬────────────┬──────┬──────────┐
│ App name        │ id │ version │ mode │ pid   │ status  │ restart │ uptime │ cpu   │ mem        │ user │ watching │
├─────────────────┼────┼─────────┼──────┼───────┼─────────┼─────────┼────────┼───────┼────────────┼──────┼──────────┤
│ advancement     │ 12 │ N/A     │ fork │ 9082  │ online  │ 62      │ 9D     │ 0.6%  │ 188.3 MB   │ root │ disabled │
│ bloblogs        │ 7  │ 1.0.0   │ fork │ 16020 │ online  │ 21336   │ 2M     │ 3.7%  │ 269.4 MB   │ root │ disabled │
│ cbr             │ 11 │ N/A     │ fork │ 14644 │ online  │ 0       │ 2M     │ 0.2%  │ 86.1 MB    │ root │ disabled │
│ centurion       │ 5  │ 1.0.0   │ fork │ 14603 │ online  │ 0       │ 2M     │ 0.3%  │ 55.6 MB    │ root │ disabled │
│ cryptobot       │ 8  │ 1.0.0   │ fork │ 15799 │ online  │ 158393  │ 2M     │ 4.5%  │ 257.1 MB   │ root │ disabled │
│ csnet           │ 26 │ 1.0.0   │ fork │ 4256  │ online  │ 2       │ 44h    │ 0.4%  │ 96.8 MB    │ root │ disabled │
│ fedauth         │ 27 │ 1.0.0   │ fork │ 10673 │ online  │ 9       │ 8h     │ 0.6%  │ 87.6 MB    │ root │ disabled │
│ hhtrials        │ 10 │ N/A     │ fork │ 14637 │ online  │ 0       │ 2M     │ 0.3%  │ 85.3 MB    │ root │ disabled │
│ lolibot         │ 4  │ 1.0.0   │ fork │ 10740 │ online  │ 11      │ 7D     │ 4.2%  │ 232.0 MB   │ root │ disabled │
│ pkg             │ 1  │ 1.0.0   │ fork │ 14574 │ online  │ 0       │ 2M     │ 3.9%  │ 197.3 MB   │ root │ disabled │
│ slj             │ 2  │ 1.0.0   │ fork │ 14581 │ online  │ 0       │ 2M     │ 5.1%  │ 195.5 MB   │ root │ disabled │
│ steam           │ 0  │ 1.0.0   │ fork │ 9167  │ online  │ 44      │ 27h    │ 11.8% │ 797.8 MB   │ root │ disabled │
│ suggest         │ 9  │ 1.0.0   │ fork │ 15826 │ online  │ 228385  │ 2M     │ 0.3%  │ 67.3 MB    │ root │ disabled │
│ terry           │ 6  │ 1.0.0   │ fork │ 12813 │ online  │ 249067  │ 17D    │ 0.3%  │ 80.1 MB    │ root │ disabled │
│ verification    │ 25 │ N/A     │ fork │ 10930 │ online  │ 49      │ 5m     │ 1.6%  │ 88.1 MB    │ root │ disabled │
│ welcomersupport │ 3  │ 1.0.0   │ fork │ 14588 │ online  │ 0       │ 2M     │ 0.3%  │ 91.8 MB    │ root │ disabled │
│ wolfy           │ 15 │ 1.2.9   │ fork │ 0     │ stopped │ 0       │ 0      │ 0%    │ 0 B        │ root │ disabled │
└─────────────────┴────┴─────────┴──────┴───────┴─────────┴─────────┴────────┴───────┴────────────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2        | 2019-07-27T09:46:23: PM2 log: Stopping app:fedauth id:27
PM2        | 2019-07-27T09:46:24: PM2 log: App [fedauth:27] exited with code [0] via signal [SIGINT]
PM2        | 2019-07-27T09:46:24: PM2 log: pid=28559 msg=process killed
PM2        | 2019-07-27T09:46:24: PM2 log: App [fedauth:27] starting in -fork mode-
PM2        | 2019-07-27T09:46:24: PM2 log: App [fedauth:27] online
PM2        | 2019-07-27T10:08:53: PM2 log: Stopping app:fedauth id:27
PM2        | 2019-07-27T10:08:53: PM2 log: App [fedauth:27] exited with code [0] via signal [SIGINT]
PM2        | 2019-07-27T10:08:53: PM2 log: pid=8252 msg=process killed
PM2        | 2019-07-27T10:08:53: PM2 log: App [fedauth:27] starting in -fork mode-
PM2        | 2019-07-27T10:08:53: PM2 log: App [fedauth:27] online
PM2        | 2019-07-27T10:13:35: PM2 log: Stopping app:verification id:25
PM2        | 2019-07-27T10:13:35: PM2 log: App [verification:25] exited with code [0] via signal [SIGINT]
PM2        | 2019-07-27T10:13:35: PM2 log: pid=5222 msg=process killed
PM2        | 2019-07-27T10:13:35: PM2 log: App [verification:25] starting in -fork mode-
PM2        | 2019-07-27T10:13:35: PM2 log: App [verification:25] online
PM2        | 2019-07-27T18:52:03: PM2 log: Stopping app:verification id:25
PM2        | 2019-07-27T18:52:03: PM2 log: App [verification:25] exited with code [0] via signal [SIGINT]
PM2        | 2019-07-27T18:52:03: PM2 log: pid=11310 msg=process killed
PM2        | 2019-07-27T18:52:03: PM2 log: App [verification:25] starting in -fork mode-
PM2        | 2019-07-27T18:52:03: PM2 log: App [verification:25] online

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running pm2 list in a terminal and trace the code path that formats its colored output; the issue does not name a file or test. The work is done when the command leaves the terminal prompt with its previous color and style restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.