Skip to content

Commit 4ac713b

Browse files
Do an actual check for SUPPORTS_SOCKETS.
1 parent 29fd8e5 commit 4ac713b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/test/common/platform/utils.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ export const SUPPORTS_SYMLINKS = (() => {
2626
fsextra.unlinkSync(symlink);
2727
return true;
2828
})();
29-
30-
export const SUPPORTS_SOCKETS = true;
29+
export const SUPPORTS_SOCKETS = (() => {
30+
const tmp = tmpMod.dirSync({
31+
prefix: 'pyvsc-test-',
32+
unsafeCleanup: true // for non-empty dir
33+
});
34+
const filename = path.join(tmp.name, 'test.sock');
35+
try {
36+
const srv = net.createServer();
37+
try {
38+
srv.listen(filename);
39+
} finally {
40+
srv.close();
41+
}
42+
} catch {
43+
return false;
44+
} finally {
45+
tmp.removeCallback();
46+
}
47+
return true;
48+
})();
3149

3250
export const DOES_NOT_EXIST = 'this file does not exist';
3351

0 commit comments

Comments
 (0)