Skip to content

Commit 52a315b

Browse files
committed
Fix stop command. Closes #205
Closes #205
1 parent d95b4c3 commit 52a315b

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
> **Note**: odd version numbers, for example, `0.13.0`, are not included in this changelog. They are used to test the new features and fixes before the final release.
99
10-
## [0.18.2] - 2025-03-03
10+
## [0.18.3] - 2025-03-03
1111

1212
### Added:
1313

@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Install: Fixed broken link for Linux
3333
- Install: Updated brew tap command to reference new tap location
3434
- Install: Fixed incorrect homebrew formulae name
35+
- Commands: Fixed issue with stop command not waiting to ensure Dev Proxy process has fully stopped before disposing of terminal
3536

3637
## [0.16.0] - 2025-02-03
3738

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dev-proxy-toolkit",
33
"displayName": "Dev Proxy Toolkit",
44
"description": "Makes it easy to create and update Dev Proxy configuration files.",
5-
"version": "0.18.2",
5+
"version": "0.18.3",
66
"publisher": "garrytrinder",
77
"engines": {
88
"vscode": "^1.89.0"

src/commands.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const registerCommands = (context: vscode.ExtensionContext, configuration
88
vscode.commands.registerCommand('dev-proxy-toolkit.install', async (platform: NodeJS.Platform) => {
99
const versionPreference = configuration.get('version') as VersionPreference;
1010
const message = vscode.window.setStatusBarMessage('Installing Dev Proxy...');
11-
11+
1212
// we are on windows so we can use winget
1313
if (platform === 'win32') {
1414
const id = versionPreference === VersionPreference.Stable ? 'Microsoft.DevProxy' : 'Microsoft.DevProxy.Beta';
@@ -35,6 +35,14 @@ export const registerCommands = (context: vscode.ExtensionContext, configuration
3535
// we are on macos so we can use brew
3636
if (platform === 'darwin') {
3737
const id = versionPreference === VersionPreference.Stable ? 'dev-proxy' : 'dev-proxy-beta';
38+
// check if brew is installed
39+
try {
40+
await executeCommand('brew --version');
41+
} catch (error) {
42+
await vscode.window.showErrorMessage('Homebrew is not installed. Please install brew and try again.');
43+
return;
44+
}
45+
3846
try {
3947
await executeCommand('brew tap dotnet/dev-proxy');
4048
await executeCommand(`brew install ${id}`);
@@ -105,6 +113,23 @@ export const registerCommands = (context: vscode.ExtensionContext, configuration
105113

106114
const closeTerminal = configuration.get('closeTerminal') as boolean;
107115
if (closeTerminal) {
116+
const checkProxyStatus = async () => {
117+
try {
118+
const response = await fetch(`http://localhost:${apiPort}/proxy`);
119+
return response.ok;
120+
} catch {
121+
return false;
122+
}
123+
};
124+
125+
let isRunning = true;
126+
while (isRunning) {
127+
isRunning = await checkProxyStatus();
128+
if (isRunning) {
129+
await new Promise(resolve => setTimeout(resolve, 1000));
130+
}
131+
}
132+
108133
vscode.window.terminals.forEach(terminal => {
109134
if (terminal.name === 'Dev Proxy') {
110135
terminal.dispose();

0 commit comments

Comments
 (0)