Skip to content

Commit

Permalink
Restore socket write patch (#33)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
code-asher authored Dec 23, 2021
1 parent 76663e7 commit acfcdb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/vs/server/@types/code-server-lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ declare global {
executableName: string;
}

export type RemoteCLIMain = (desc: ProductDescription, args: string[]) => void;

export interface IServerAPI {
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
handleUpgrade(req: http.IncomingMessage, socket: net.Socket): void;
Expand Down
5 changes: 2 additions & 3 deletions src/vs/server/remoteCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,5 @@ function mapFileToRemoteUri(uri: string): string {
return uri.replace(/^file:\/\//, 'vscode-remote://' + cliRemoteAuthority);
}

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

let [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
main({ productName, version, commit, executableName }, remainingArgs);
11 changes: 11 additions & 0 deletions src/vs/workbench/api/node/extHostExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { promises as fs } from 'fs';
import * as os from 'os'
import * as path from 'vs/base/common/path';
import * as performance from 'vs/base/common/performance';
import { createApiFactoryAndRegisterActors } from 'vs/workbench/api/common/extHost.api.impl';
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
Expand Down Expand Up @@ -59,6 +62,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
if (this._initData.remote.isRemote && this._initData.remote.authority) {
const cliServer = this._instaService.createInstance(CLIServer);
process.env['VSCODE_IPC_HOOK_CLI'] = cliServer.ipcHandlePath;

/**
* Write this out so we can get the most recent path.
* @author coder
*/
fs.writeFile(path.join(os.tmpdir(), 'vscode-ipc'), cliServer.ipcHandlePath).catch((error) => {
this._logService.error(error);
});
}

// Module loading tricks
Expand Down

0 comments on commit acfcdb5

Please sign in to comment.