Skip to content

Commit 05a3d22

Browse files
TylerLeonhardtRobert Holt
authored and
Robert Holt
committed
Use named pipes as transport
* Pass ACL'd named pipes from VSCode to EditorServices * Remove TCP as a transport option
1 parent 4223d86 commit 05a3d22

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Diff for: src/debugAdapter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function startDebugging() {
4343
debugAdapterLogWriter.write("Connecting to pipe: " + sessionDetails.debugServicePipeName + "\r\n");
4444

4545
let isConnected = false;
46-
const debugServiceSocket = net.connect(utils.getPipePath(sessionDetails.debugServicePipeName));
46+
const debugServiceSocket = net.connect(sessionDetails.debugServicePipeName);
4747

4848
// Write any errors to the log file
4949
debugServiceSocket.on(

Diff for: src/session.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,13 @@ export class SessionManager implements Middleware {
166166
}
167167
}
168168

169-
// Generate a random id for the named pipes in case they have multiple instances of PSES running
170-
const id = crypto.randomBytes(10).toString("hex");
171169
this.editorServicesArgs =
172170
`-HostName 'Visual Studio Code Host' ` +
173171
`-HostProfileId 'Microsoft.VSCode' ` +
174172
`-HostVersion '${this.hostVersion}'` +
175173
`-AdditionalModules @('PowerShellEditorServices.VSCode') ` +
176174
`-BundledModulesPath '${PowerShellProcess.escapeSingleQuotes(this.bundledModulesPath)}'` +
177175
`-EnableConsoleRepl ` +
178-
`-LanguageServicePipeName LanguageService_${id}.pipe ` +
179-
`-DebugServicePipeName DebugService_${id}.pipe `;
180176

181177
if (this.sessionSettings.developer.editorServicesWaitForDebugger) {
182178
this.editorServicesArgs += "-WaitForDebugger ";
@@ -535,19 +531,16 @@ export class SessionManager implements Middleware {
535531
}
536532

537533
private startLanguageClient(sessionDetails: utils.IEditorServicesSessionDetails) {
538-
539-
const pipeName = sessionDetails.languageServicePipeName;
540-
541534
// Log the session details object
542535
this.log.write(JSON.stringify(sessionDetails));
543536

544537
try {
545-
this.log.write("Connecting to language service on pipe " + pipeName + "...");
538+
this.log.write(`Connecting to language service on pipe ${sessionDetails.languageServicePipeName}...`);
546539

547540
const connectFunc = () => {
548541
return new Promise<StreamInfo>(
549542
(resolve, reject) => {
550-
const socket = net.connect(utils.getPipePath(pipeName));
543+
const socket = net.connect(sessionDetails.languageServicePipeName);
551544
socket.on(
552545
"connect",
553546
() => {

0 commit comments

Comments
 (0)