Skip to content

Commit acfcdb5

Browse files
authored
Restore socket write patch (#33)
* Remove unused patch for remote CLI * Restore socket write patch This allows external processes to read the socket or pipe and open files in VS Code.
1 parent 76663e7 commit acfcdb5

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/vs/server/@types/code-server-lib/index.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ declare global {
126126
executableName: string;
127127
}
128128

129-
export type RemoteCLIMain = (desc: ProductDescription, args: string[]) => void;
130-
131129
export interface IServerAPI {
132130
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
133131
handleUpgrade(req: http.IncomingMessage, socket: net.Socket): void;

src/vs/server/remoteCli.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,5 @@ function mapFileToRemoteUri(uri: string): string {
410410
return uri.replace(/^file:\/\//, 'vscode-remote://' + cliRemoteAuthority);
411411
}
412412

413-
// let [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
414-
// main({ productName, version, commit, executableName }, remainingArgs);
415-
413+
let [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
414+
main({ productName, version, commit, executableName }, remainingArgs);

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

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { promises as fs } from 'fs';
7+
import * as os from 'os'
8+
import * as path from 'vs/base/common/path';
69
import * as performance from 'vs/base/common/performance';
710
import { createApiFactoryAndRegisterActors } from 'vs/workbench/api/common/extHost.api.impl';
811
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
@@ -59,6 +62,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
5962
if (this._initData.remote.isRemote && this._initData.remote.authority) {
6063
const cliServer = this._instaService.createInstance(CLIServer);
6164
process.env['VSCODE_IPC_HOOK_CLI'] = cliServer.ipcHandlePath;
65+
66+
/**
67+
* Write this out so we can get the most recent path.
68+
* @author coder
69+
*/
70+
fs.writeFile(path.join(os.tmpdir(), 'vscode-ipc'), cliServer.ipcHandlePath).catch((error) => {
71+
this._logService.error(error);
72+
});
6273
}
6374

6475
// Module loading tricks

0 commit comments

Comments
 (0)