Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 13, 2018
1 parent be812f7 commit e7a70c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
20 changes: 10 additions & 10 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const listProcesses = async (processes, flags) => {
message: 'Running processes:',
type: 'autocomplete',
pageSize: 10,
source: async (answers, input) => filterProcesses(input, processes, flags)
source: async (answers, input) => filterProcesses(input, processes, flags) // eslint-disable-line require-await
}]);

try {
Expand All @@ -126,12 +126,12 @@ const listProcesses = async (processes, flags) => {
const init = async flags => {
escExit();

const getPortsFromPid = (val, list) => {
const getPortsFromPid = (value, list) => {
const ports = [];

for (const x of list.entries()) {
if (val === x[1]) {
ports.push(String(x[0]));
for (const [key, listValue] of list.entries()) {
if (value === listValue) {
ports.push(String(key));
}
}

Expand All @@ -142,19 +142,19 @@ const init = async flags => {
pidFromPort.list(),
psList({all: false})
]);
const procs = processes.map(x => Object.assign(x, {ports: getPortsFromPid(x.pid, pids)}));
const procs = processes.map(proc => ({...proc, ports: getPortsFromPid(proc.pid, pids)}));
listProcesses(procs, flags);
};

if (cli.input.length === 0) {
init(cli.flags);
} else {
const promise = fkill(cli.input, Object.assign(cli.flags, {ignoreCase: true}));
const promise = fkill(cli.input, {...cli.flags, ignoreCase: true});

if (!cli.flags.force) {
promise.catch(err => {
if (/Couldn't find a process with port/.test(err.message)) {
console.error(err.message);
promise.catch(error => {
if (/Couldn't find a process with port/.test(error.message)) {
console.error(error.message);
process.exit(1);
}

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@
"cli-truncate": "^1.0.0",
"esc-exit": "^2.0.0",
"fkill": "^5.2.0",
"inquirer": "^5.2.0",
"inquirer-autocomplete-prompt": "^0.12.2",
"inquirer": "^6.2.0",
"inquirer-autocomplete-prompt": "^1.0.1",
"meow": "^5.0.0",
"num-sort": "^1.0.0",
"pid-from-port": "^1.1.1",
"ps-list": "^4.0.0"
"ps-list": "^5.0.1"
},
"devDependencies": {
"ava": "*",
"delay": "^2.0.0",
"execa": "^0.10.0",
"get-port": "^3.2.0",
"ava": "^0.25.0",
"delay": "^4.1.0",
"execa": "^1.0.0",
"get-port": "^4.0.0",
"noop-process": "^3.1.0",
"process-exists": "^3.1.0",
"xo": "*"
"xo": "^0.23.0"
}
}
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('kill from port', async t => {
const {pid} = childProcess.spawn('node', ['fixture.js', port]);
await execa('./cli.js', ['--force', pid]);
await noopProcessKilled(t, pid);
t.is(await getPort(port), port);
t.is(await getPort({port}), port);
});

test('error when process is not found', async t => {
Expand Down

0 comments on commit e7a70c1

Please sign in to comment.