Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Fix unhandled exceptions in port-scanner. (eclipse#281)
Browse files Browse the repository at this point in the history
In case IPv6 was disabled, `/proc/net/tcp6` will not exist.
(Probably IPv4 will be similar.)

Signed-off-by: Masaki Muranaka <monaka@monami-ya.com>
  • Loading branch information
monaka committed Jul 1, 2019
1 parent e59c745 commit 09440f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/ports-plugin/src/port-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ export class PortScanner {
const ipConverter = new IpConverter();
// connect to /proc/net/tcp and /proc/net/tcp6
const command = new Command(__dirname);
const outputv4 = await command.exec(PortScanner.GRAB_PORTS_IPV4);
const outputv6 = await command.exec(PortScanner.GRAB_PORTS_IPV6);
const outputv4 = await command
.exec(PortScanner.GRAB_PORTS_IPV4)
.catch(e => { console.error(e); return ''; });
const outputv6 = await command
.exec(PortScanner.GRAB_PORTS_IPV6);
.catch(e => { console.error(e); return ''; });

// assembe ipv4 and ipv6 output
const output = `
Expand Down

0 comments on commit 09440f5

Please sign in to comment.