Skip to content

Commit

Permalink
server.cli.ts does not await Promises (microsoft#235738)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli authored Dec 10, 2024
1 parent d239906 commit f43f3cc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions resources/server/bin-dev/remote-cli/code.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@echo off
setlocal
SET VSCODE_PATH=%~dp0..\..\..\..
SET VSCODE_DEV=1
FOR /F "tokens=* USEBACKQ" %%g IN (`where /r "%VSCODE_PATH%\.build\node" node.exe`) do (SET "NODE=%%g")
call "%NODE%" "%VSCODE_PATH%\out\server-cli.js" "Code Server - Dev" "" "" "code.cmd" %*
endlocal
2 changes: 2 additions & 0 deletions resources/server/bin-dev/remote-cli/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ else
VSCODE_PATH=$(dirname $(dirname $(dirname $(dirname $(dirname $(readlink -f $0))))))
fi

export VSCODE_DEV=1

PROD_NAME="Code Server - Dev"
VERSION=""
COMMIT=""
Expand Down
2 changes: 1 addition & 1 deletion src/server-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ if (process.env['VSCODE_DEV']) {
await bootstrapESM();

// Load Server
await import('./vs/server/node/server.cli');
await import('./vs/server/node/server.cli.js');
14 changes: 7 additions & 7 deletions src/vs/server/node/server.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
}
if (cliPipe) {
if (parsedArgs['openExternal']) {
openInBrowser(parsedArgs['_'], verbose);
await openInBrowser(parsedArgs['_'], verbose);
return;
}
}
Expand Down Expand Up @@ -294,7 +294,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
}
} else {
if (parsedArgs.status) {
sendToPipe({
await sendToPipe({
type: 'status'
}, verbose).then((res: string) => {
console.log(res);
Expand All @@ -305,7 +305,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
}

if (parsedArgs['install-extension'] !== undefined || parsedArgs['uninstall-extension'] !== undefined || parsedArgs['list-extensions'] || parsedArgs['update-extensions']) {
sendToPipe({
await sendToPipe({
type: 'extensionManagement',
list: parsedArgs['list-extensions'] ? { showVersions: parsedArgs['show-versions'], category: parsedArgs['category'] } : undefined,
install: asExtensionIdOrVSIX(parsedArgs['install-extension']),
Expand All @@ -328,7 +328,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
waitMarkerFilePath = createWaitMarkerFileSync(verbose);
}

sendToPipe({
await sendToPipe({
type: 'open',
fileURIs,
folderURIs,
Expand All @@ -345,7 +345,7 @@ export async function main(desc: ProductDescription, args: string[]): Promise<vo
});

if (waitMarkerFilePath) {
waitForFileDeleted(waitMarkerFilePath);
await waitForFileDeleted(waitMarkerFilePath);
}

if (readFromStdinPromise) {
Expand All @@ -371,7 +371,7 @@ async function waitForFileDeleted(path: string) {
}
}

function openInBrowser(args: string[], verbose: boolean) {
async function openInBrowser(args: string[], verbose: boolean) {
const uris: string[] = [];
for (const location of args) {
try {
Expand All @@ -385,7 +385,7 @@ function openInBrowser(args: string[], verbose: boolean) {
}
}
if (uris.length) {
sendToPipe({
await sendToPipe({
type: 'openExternal',
uris
}, verbose).catch(e => {
Expand Down

0 comments on commit f43f3cc

Please sign in to comment.