Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b34d3b5

Browse files
kevvasindresorhus
authored andcommitted
Take port length into account when calculating margins (sindresorhus#44)
1 parent 1ba0732 commit b34d3b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function filterProcesses(input, processes, flags) {
101101
.sort((a, b) => numSort.asc(a.pid, b.pid))
102102
.map(proc => {
103103
const lineLength = process.stdout.columns || 80;
104-
const margins = commandLineMargins + proc.pid.toString().length;
104+
const margins = commandLineMargins + proc.pid.toString().length + proc.port.length;
105105
const length = lineLength - margins;
106106
const name = cliTruncate(flags.verbose ? proc.cmd : proc.name, length, {position: 'middle'});
107107
const port = proc.port && `:${proc.port}`;

0 commit comments

Comments
 (0)