Skip to content

Commit ffe64da

Browse files
authored
cli: fix error starting remote tunnels (microsoft#185701)
* untested wip * cli: fix error starting remote tunnels Fixes microsoft#185585 Output was prefixed which prevented the lines from being split to detect the tunnel status.
1 parent 3b49115 commit ffe64da

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

build/gulpfile.vscode.win32.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function buildWin32Setup(arch, target) {
101101
AppMutex: product.win32MutexName,
102102
TunnelMutex: product.win32TunnelMutex,
103103
TunnelServiceMutex: product.win32TunnelServiceMutex,
104+
TunnelApplicationName: product.tunnelApplicationName,
104105
ApplicationName: product.applicationName,
105106
Arch: arch,
106107
AppId: { 'ia32': ia32AppId, 'x64': x64AppId, 'arm64': arm64AppId }[arch],

build/win32/code.iss

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ begin
13621362
end;
13631363
end;
13641364
1365-
if IsNotBackgroundUpdate() and CheckForMutexes('{#TunnelMutex}') then
1365+
if IsNotBackgroundUpdate() and not StopTunnelProcesses() then
13661366
begin
13671367
MsgBox('{#NameShort} is still running a tunnel. Please stop the tunnel before installing.', mbInformation, MB_OK);
13681368
Result := false
@@ -1380,6 +1380,30 @@ end;
13801380
var
13811381
ShouldRestartTunnelService: Boolean;
13821382
1383+
function StopTunnelProcesses();
1384+
var
1385+
WaitCounter: Integer;
1386+
TaskKilled: Integer;
1387+
begin
1388+
Log('Stopping all tunnel services with taskkill');
1389+
Exec('taskkill.exe', '/f /im "' + ExpandConstant('"{app}\bin\{#TunnelApplicationName}.exe"') + '"', '', SW_HIDE, ewWaitUntilTerminated, TaskKilled);
1390+
1391+
WaitCounter := 10;
1392+
while (WaitCounter > 0) and CheckForMutexes('{#TunnelMutex}') do
1393+
begin
1394+
Log('Tunnel process is is still running, waiting');
1395+
Sleep(500);
1396+
WaitCounter := WaitCounter - 1
1397+
end;
1398+
1399+
if CheckForMutexes('{#TunnelMutex}') then
1400+
Log('Unable to stop tunnel processes')
1401+
exit(False)
1402+
else
1403+
exit(True)
1404+
end
1405+
end;
1406+
13831407
procedure StopTunnelServiceIfNeeded();
13841408
var
13851409
StopServiceResultCode: Integer;
@@ -1607,4 +1631,4 @@ begin
16071631
#endif
16081632
16091633
Exec(ExpandConstant('{sys}\icacls.exe'), ExpandConstant('"{app}" /inheritancelevel:r ') + Permissions, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
1610-
end;
1634+
end;

src/vs/platform/remoteTunnel/node/remoteTunnelService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
340340
}
341341
});
342342
if (!this.environmentService.isBuilt) {
343-
onOutput('Building tunnel CLI from sources and run', false);
344-
onOutput(`${logLabel} Spawning: cargo run -- tunnel ${commandArgs.join(' ')}`, false);
343+
onOutput('Building tunnel CLI from sources and run\n', false);
344+
onOutput(`${logLabel} Spawning: cargo run -- tunnel ${commandArgs.join(' ')}\n`, false);
345345
tunnelProcess = spawn('cargo', ['run', '--', 'tunnel', ...commandArgs], { cwd: join(this.environmentService.appRoot, 'cli'), stdio });
346346
} else {
347-
onOutput('Running tunnel CLI', false);
347+
onOutput('Running tunnel CLI\n', false);
348348
const tunnelCommand = this.getTunnelCommandLocation();
349-
onOutput(`${logLabel} Spawning: ${tunnelCommand} tunnel ${commandArgs.join(' ')}`, false);
349+
onOutput(`${logLabel} Spawning: ${tunnelCommand} tunnel ${commandArgs.join(' ')}\n`, false);
350350
tunnelProcess = spawn(tunnelCommand, ['tunnel', ...commandArgs], { cwd: homedir(), stdio });
351351
}
352352

0 commit comments

Comments
 (0)