Skip to content

Commit e9389df

Browse files
Enhance/kill monitor timeout (#358)
* add timeout setting use abs shell path * add note in esp-idf monitor * add timeout to settings doc * fix audit add changelog
1 parent ebdd8ea commit e9389df

File tree

11 files changed

+586
-352
lines changed

11 files changed

+586
-352
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717

1818
All notable changes to the "Espressif IDF" extension will be documented in this file.
1919

20+
## [1.0.2](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.0.2)
21+
22+
### Features and enhancements
23+
24+
- [Add monitor process kill timeout configuration setting](https://github.com/espressif/vscode-esp-idf-extension/pull/358)
25+
26+
### Bug Fixes
27+
28+
- [Fix monitor shell executable path for monitor command](https://github.com/espressif/vscode-esp-idf-extension/pull/358)
29+
- [Tasks presentation options fixes](https://github.com/espressif/vscode-esp-idf-extension/pull/357)
30+
- [Remove IDF version validation](https://github.com/espressif/vscode-esp-idf-extension/pull/351)
31+
2032
## [1.0.1](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.0.1)
2133

2234
### Features and enhancements

docs/FEATURES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ You can follow [this](./HEAP_TRACING.md) quick step-by-step guide for heap traci
6565

6666
**ESP-IDF: Monitor your device** is provided by this extension to start `idf.py monitor` terminal program in Visual Studio Code. Please take a look at the [IDF Monitor documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html?highlight=monitor).
6767

68+
In Visual Studio Code, for **ESP-IDF: Monitor your device** we use the shell executable given in `vscode.env.shell` which is override by `terminal.integrated.shell.*` in your Visual Studio Code Settings when using the `Terminal: Select Default Shell` command to update the shell or updating `terminal.integrated.shell.windows` for Windows, `terminal.integrated.shell.osx` for MacOS and `terminal.integrated.shell.linux` for Linux in VSCode Settings Preference menu (F1 -> Preferences: Open Settings (JSON)).
69+
6870
## SDK Configuration editor
6971

7072
### Prerequisites

docs/SETTINGS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ These settings are used to configure the [Code coverage](./COVERAGE.md) colors.
7878
| `idf.useIDFKconfigStyle` | Enable style validation for Kconfig files |
7979
| `idf.saveScope` | Where to save extension settings |
8080
| `idf.launchMonitorOnDebugSession` | Launch ESP-IDF Monitor along with ESP-IDF Debug session |
81+
| `idf.killMonitorTimeout` | Timeout (milliseconds) for ESP-IDF monitor process kill |
8182

8283
The `idf.saveScope` allows the user to specify where to save settings when using commands such as `Configure Paths`, `Device configuration`, `Set Espressif device target` and other commands. Possible values are Global (User Settings), Workspace and WorkspaceFolder. For more information please take a look at [Working with multiple projects](./MULTI_PROJECTS.md).
8384

i18n/en/package.i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"param.saveScope": "Where to save configuration with ESP-IDF commands with number value as vscode.ConfigurationTarget. Global = 1, Workspace= 2, WorkspaceFolder=3",
7676
"param.rainmaker.api.server_url": "ESP-Rainmaker cloud server URL",
7777
"param.launchMonitorOnDebugSession.title": "Start IDF Monitor along with ESP-IDF Debug Adapter session",
78+
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
7879
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
7980
"esp.rainmaker.backend.connect.title": "Connect with ESP-Rainmaker Cloud Server",
8081
"esp.rainmaker.backend.logout.title": "Unlink Rainmaker Account",

i18n/es/package.i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"param.uncoveredLightTheme": "Color de fondo para lineas no cubiertas en temas claros por ESP-IDF Coverage.",
6262
"param.uncoveredDarkTheme": "Color de fondo para lineas no cubiertas en temas oscuros por ESP-IDF Coverage.",
6363
"param.launchMonitorOnDebugSession.title": "Iniciar IDF Monitor junto a la sesión ESP-IDF Debug Adapter",
64+
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
6465
"view.components.name": "Componentes de proyecto",
6566
"configuration.title": "ESP-IDF",
6667
"espIdf.apptrace.archive.refresh.title": "Refresh Trace Archive List",

i18n/ru/package.i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"param.uncoveredLightTheme": "Цвет фона для непокрытых линий в светлой теме для покрытия кода ESP-IDF.",
6262
"param.uncoveredDarkTheme": "Цвет фона для непокрытых линий в темной теме для покрытия кода ESP-IDF.",
6363
"param.launchMonitorOnDebugSession.title": "Запустите IDF Monitor вместе с сеансом ESP-IDF Debug Adapter.",
64+
"param.killMonitorTimeout.title": "Тайм-аут (миллисекунды) для завершения процесса монитора ESP-IDF",
6465
"view.components.name": "Компоненты проекта",
6566
"configuration.title": "ESP-IDF",
6667
"espIdf.apptrace.archive.refresh.title": "Обновить список архива трассировки",

i18n/zh-CN/package.i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"param.uncoveredLightTheme": "ESP-IDF覆盖的光主题中未覆盖线条的背景色",
6262
"param.uncoveredDarkTheme": "ESP-IDF覆盖的深色主题中未覆盖线条的背景色",
6363
"param.launchMonitorOnDebugSession.title": "启动IDF监视器和ESP-IDF调试适配器会话",
64+
"param.killMonitorTimeout.title": "ESP-IDF监视器进程终止超时(毫秒)",
6465
"view.components.name": "项目组件",
6566
"configuration.title": "ESP-IDF",
6667
"espIdf.apptrace.archive.refresh.title": "刷新跟踪归档列表",

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,12 @@
593593
"description": "%param.launchMonitorOnDebugSession.title%",
594594
"scope": "resource",
595595
"default": true
596+
},
597+
"idf.killMonitorTimeout": {
598+
"type": "number",
599+
"description": "%param.killMonitorTimeout.title%",
600+
"scope": "resource",
601+
"default": 1000
596602
}
597603
}
598604
}

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"param.saveScope": "Where to save configuration with ESP-IDF commands with number value as vscode.ConfigurationTarget. Global = 1, Workspace= 2, WorkspaceFolder=3",
7676
"param.rainmaker.api.server_url": "ESP-Rainmaker cloud server URL",
7777
"param.launchMonitorOnDebugSession.title": "Start IDF Monitor along with ESP-IDF Debug Adapter session",
78+
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
7879
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
7980
"esp.rainmaker.backend.connect.title": "Connect with ESP-Rainmaker Cloud Server",
8081
"esp.rainmaker.backend.logout.title": "Unlink Rainmaker Account",

src/extension.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,12 @@ export async function activate(context: vscode.ExtensionContext) {
360360

361361
vscode.window.onDidCloseTerminal(async (terminal: vscode.Terminal) => {
362362
const terminalPid = await terminal.processId;
363-
const monitorTerminalPid = (await monitorTerminal?.processId) || -1;
363+
const monitorTerminalPid = monitorTerminal
364+
? await monitorTerminal.processId
365+
: -1;
364366
if (monitorTerminalPid === terminalPid) {
365367
monitorTerminal = undefined;
366-
kill(monitorTerminalPid);
368+
kill(monitorTerminalPid, "SIGKILL");
367369
}
368370
});
369371

@@ -2426,8 +2428,10 @@ const flash = () => {
24262428
}
24272429

24282430
if (monitorTerminal) {
2429-
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
24302431
monitorTerminal.dispose();
2432+
const killTimeout = idfConf.readParameter("idf.killMonitorTimeout");
2433+
await utils.sleep(killTimeout);
2434+
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
24312435
}
24322436

24332437
const idfPathDir = idfConf.readParameter("idf.espIdfPath");
@@ -2555,8 +2559,10 @@ const buildFlashAndMonitor = (runMonitor: boolean = true) => {
25552559
return;
25562560
}
25572561
if (monitorTerminal) {
2558-
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
25592562
monitorTerminal.dispose();
2563+
const killTimeout = idfConf.readParameter("idf.killMonitorTimeout");
2564+
await utils.sleep(killTimeout);
2565+
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
25602566
}
25612567
const buildTask = new BuildTask(workspaceRoot.fsPath);
25622568
const buildPath = path.join(workspaceRoot.fsPath, "build");
@@ -2731,13 +2737,12 @@ function createMonitor() {
27312737
return reject(new Error("NOT_SELECTED_PORT"));
27322738
}
27332739
if (typeof monitorTerminal === "undefined") {
2734-
const shellExecutable = path.basename(vscode.env.shell);
27352740
monitorTerminal = vscode.window.createTerminal({
27362741
name: "ESP-IDF Monitor",
27372742
env: modifiedEnv,
27382743
cwd: workspaceRoot.fsPath,
27392744
shellArgs: [],
2740-
shellPath: shellExecutable,
2745+
shellPath: vscode.env.shell,
27412746
strictEnv: true,
27422747
});
27432748
}

0 commit comments

Comments
 (0)