Skip to content

Commit 69711c2

Browse files
Use temporary directory for debug sockets on NIX systems (#4637)
Fixes: #4523 This PR stores debug sockets in `/tmp/` or `$TMPDIR` (if set) on Linux & OSX platforms.
1 parent 8fb5ebe commit 69711c2

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/common.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ export function getExtensionPath() {
2323
return extensionPath;
2424
}
2525

26+
export function getUnixTempDirectory(){
27+
let envTmp = process.env.TMPDIR;
28+
if(!envTmp)
29+
{
30+
return "/tmp/";
31+
}
32+
33+
return envTmp;
34+
}
35+
2636
export function isBoolean(obj: any): obj is boolean {
2737
return obj === true || obj === false;
2838
}

src/features/dotnetTest.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,13 @@ class DebugEventListener {
545545
this._fileName = fileName;
546546
this._server = server;
547547
this._eventStream = eventStream;
548-
// NOTE: The max pipe name on OSX is fairly small, so this name shouldn't bee too long.
549-
const pipeSuffix = "TestDebugEvents-" + process.pid;
548+
550549
if (os.platform() === 'win32') {
551-
this._pipePath = "\\\\.\\pipe\\Microsoft.VSCode.CSharpExt." + pipeSuffix;
552-
} else {
553-
this._pipePath = path.join(utils.getExtensionPath(), "." + pipeSuffix);
550+
this._pipePath = "\\\\.\\pipe\\Microsoft.VSCode.CSharpExt.TestDebugEvents" + process.pid;
551+
}
552+
else {
553+
let tmpdir = utils.getUnixTempDirectory();
554+
this._pipePath = path.join(tmpdir, "ms-dotnettools.csharp-tde-" + process.pid);
554555
}
555556
}
556557

0 commit comments

Comments
 (0)