Skip to content

Commit 61bad26

Browse files
authored
WSL terminal CLI is broken (fix microsoft#230584) (microsoft#232442)
1 parent b85dbe1 commit 61bad26

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/vs/server/node/server.cli.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import { createWaitMarkerFileSync } from '../../platform/environment/node/wait.j
1515
import { PipeCommand } from '../../workbench/api/node/extHostCLIServer.js';
1616
import { hasStdinWithoutTty, getStdinFilePath, readFromStdin } from '../../platform/environment/node/stdin.js';
1717
import { DeferredPromise } from '../../base/common/async.js';
18-
19-
const __dirname = dirname(url.fileURLToPath(import.meta.url));
18+
import { FileAccess } from '../../base/common/network.js';
2019

2120
/*
2221
* Implements a standalone CLI app that opens VS Code from a remote terminal.
@@ -150,7 +149,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
150149
case 'fish': file = 'fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish'; break;
151150
default: throw new Error('Error using --locate-shell-integration-path: Invalid shell type');
152151
}
153-
console.log(resolve(__dirname, '../..', 'workbench', 'contrib', 'terminal', 'browser', 'media', file));
152+
console.log(join(getAppRoot(), 'out', 'vs', 'workbench', 'contrib', 'terminal', 'common', 'scripts', file));
154153
return;
155154
}
156155
if (cliPipe) {
@@ -241,7 +240,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
241240
cmdLine.push('--update-extensions');
242241
}
243242

244-
const childProcess = cp.fork(join(__dirname, '../../../server-main.js'), cmdLine, { stdio: 'inherit' });
243+
const childProcess = cp.fork(FileAccess.asFileUri('server-main').fsPath, cmdLine, { stdio: 'inherit' });
245244
childProcess.on('error', err => console.log(err));
246245
return;
247246
}
@@ -496,6 +495,10 @@ function mapFileToRemoteUri(uri: string): string {
496495
return uri.replace(/^file:\/\//, 'vscode-remote://' + cliRemoteAuthority);
497496
}
498497

498+
function getAppRoot() {
499+
return dirname(FileAccess.asFileUri('').fsPath);
500+
}
501+
499502
const [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
500503
main({ productName, version, commit, executableName }, remainingArgs).then(null, err => {
501504
console.error(err.message || err.stack || err);

0 commit comments

Comments
 (0)