Skip to content

Commit 48e5c5b

Browse files
committed
Handle file errors when finding ports
Fixes microsoft#90416
1 parent 96f860d commit 48e5c5b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/vs/workbench/api/node/extHostTunnelService.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,14 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
134134
}
135135

136136
const ports: { host: string, port: number, detail: string }[] = [];
137-
const tcp: string = fs.readFileSync('/proc/net/tcp', 'utf8');
138-
const tcp6: string = fs.readFileSync('/proc/net/tcp6', 'utf8');
137+
let tcp: string = '';
138+
let tcp6: string = '';
139+
try {
140+
tcp = fs.readFileSync('/proc/net/tcp', 'utf8');
141+
tcp6 = fs.readFileSync('/proc/net/tcp6', 'utf8');
142+
} catch (e) {
143+
// File reading error. No additional handling needed.
144+
}
139145
const procSockets: string = await (new Promise(resolve => {
140146
exec('ls -l /proc/[0-9]*/fd/[0-9]* | grep socket:', (error, stdout, stderr) => {
141147
resolve(stdout);

0 commit comments

Comments
 (0)