Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance/kill monitor timeout #358

Merged
merged 4 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@

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

## [1.0.2](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.0.2)

### Features and enhancements

- [Add monitor process kill timeout configuration setting](https://github.com/espressif/vscode-esp-idf-extension/pull/358)

### Bug Fixes

- [Fix monitor shell executable path for monitor command](https://github.com/espressif/vscode-esp-idf-extension/pull/358)
- [Tasks presentation options fixes](https://github.com/espressif/vscode-esp-idf-extension/pull/357)
- [Remove IDF version validation](https://github.com/espressif/vscode-esp-idf-extension/pull/351)

## [1.0.1](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.0.1)

### Features and enhancements
Expand Down
2 changes: 2 additions & 0 deletions docs/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ You can follow [this](./HEAP_TRACING.md) quick step-by-step guide for heap traci

**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).

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)).

## SDK Configuration editor

### Prerequisites
Expand Down
1 change: 1 addition & 0 deletions docs/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ These settings are used to configure the [Code coverage](./COVERAGE.md) colors.
| `idf.useIDFKconfigStyle` | Enable style validation for Kconfig files |
| `idf.saveScope` | Where to save extension settings |
| `idf.launchMonitorOnDebugSession` | Launch ESP-IDF Monitor along with ESP-IDF Debug session |
| `idf.killMonitorTimeout` | Timeout (milliseconds) for ESP-IDF monitor process kill |

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).

Expand Down
1 change: 1 addition & 0 deletions i18n/en/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"param.saveScope": "Where to save configuration with ESP-IDF commands with number value as vscode.ConfigurationTarget. Global = 1, Workspace= 2, WorkspaceFolder=3",
"param.rainmaker.api.server_url": "ESP-Rainmaker cloud server URL",
"param.launchMonitorOnDebugSession.title": "Start IDF Monitor along with ESP-IDF Debug Adapter session",
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.connect.title": "Connect with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.logout.title": "Unlink Rainmaker Account",
Expand Down
1 change: 1 addition & 0 deletions i18n/es/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"param.uncoveredLightTheme": "Color de fondo para lineas no cubiertas en temas claros por ESP-IDF Coverage.",
"param.uncoveredDarkTheme": "Color de fondo para lineas no cubiertas en temas oscuros por ESP-IDF Coverage.",
"param.launchMonitorOnDebugSession.title": "Iniciar IDF Monitor junto a la sesión ESP-IDF Debug Adapter",
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
"view.components.name": "Componentes de proyecto",
"configuration.title": "ESP-IDF",
"espIdf.apptrace.archive.refresh.title": "Refresh Trace Archive List",
Expand Down
1 change: 1 addition & 0 deletions i18n/ru/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"param.uncoveredLightTheme": "Цвет фона для непокрытых линий в светлой теме для покрытия кода ESP-IDF.",
"param.uncoveredDarkTheme": "Цвет фона для непокрытых линий в темной теме для покрытия кода ESP-IDF.",
"param.launchMonitorOnDebugSession.title": "Запустите IDF Monitor вместе с сеансом ESP-IDF Debug Adapter.",
"param.killMonitorTimeout.title": "Тайм-аут (миллисекунды) для завершения процесса монитора ESP-IDF",
"view.components.name": "Компоненты проекта",
"configuration.title": "ESP-IDF",
"espIdf.apptrace.archive.refresh.title": "Обновить список архива трассировки",
Expand Down
1 change: 1 addition & 0 deletions i18n/zh-CN/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"param.uncoveredLightTheme": "ESP-IDF覆盖的光主题中未覆盖线条的背景色",
"param.uncoveredDarkTheme": "ESP-IDF覆盖的深色主题中未覆盖线条的背景色",
"param.launchMonitorOnDebugSession.title": "启动IDF监视器和ESP-IDF调试适配器会话",
"param.killMonitorTimeout.title": "ESP-IDF监视器进程终止超时(毫秒)",
"view.components.name": "项目组件",
"configuration.title": "ESP-IDF",
"espIdf.apptrace.archive.refresh.title": "刷新跟踪归档列表",
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@
"description": "%param.launchMonitorOnDebugSession.title%",
"scope": "resource",
"default": true
},
"idf.killMonitorTimeout": {
"type": "number",
"description": "%param.killMonitorTimeout.title%",
"scope": "resource",
"default": 1000
}
}
}
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"param.saveScope": "Where to save configuration with ESP-IDF commands with number value as vscode.ConfigurationTarget. Global = 1, Workspace= 2, WorkspaceFolder=3",
"param.rainmaker.api.server_url": "ESP-Rainmaker cloud server URL",
"param.launchMonitorOnDebugSession.title": "Start IDF Monitor along with ESP-IDF Debug Adapter session",
"param.killMonitorTimeout.title": "Timeout (milliseconds) for ESP-IDF monitor process kill",
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.connect.title": "Connect with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.logout.title": "Unlink Rainmaker Account",
Expand Down
17 changes: 11 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,12 @@ export async function activate(context: vscode.ExtensionContext) {

vscode.window.onDidCloseTerminal(async (terminal: vscode.Terminal) => {
const terminalPid = await terminal.processId;
const monitorTerminalPid = (await monitorTerminal?.processId) || -1;
const monitorTerminalPid = monitorTerminal
? await monitorTerminal.processId
: -1;
if (monitorTerminalPid === terminalPid) {
monitorTerminal = undefined;
kill(monitorTerminalPid);
kill(monitorTerminalPid, "SIGKILL");
}
});

Expand Down Expand Up @@ -2427,8 +2429,10 @@ const flash = () => {
}

if (monitorTerminal) {
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
monitorTerminal.dispose();
const killTimeout = idfConf.readParameter("idf.killMonitorTimeout");
await utils.sleep(killTimeout);
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
}

const idfPathDir = idfConf.readParameter("idf.espIdfPath");
Expand Down Expand Up @@ -2556,8 +2560,10 @@ const buildFlashAndMonitor = (runMonitor: boolean = true) => {
return;
}
if (monitorTerminal) {
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
monitorTerminal.dispose();
const killTimeout = idfConf.readParameter("idf.killMonitorTimeout");
await utils.sleep(killTimeout);
Logger.warnNotify("ESP-IDF Monitor was open. Closing it.");
}
const buildTask = new BuildTask(workspaceRoot.fsPath);
const buildPath = path.join(workspaceRoot.fsPath, "build");
Expand Down Expand Up @@ -2732,13 +2738,12 @@ function createMonitor() {
return reject(new Error("NOT_SELECTED_PORT"));
}
if (typeof monitorTerminal === "undefined") {
const shellExecutable = path.basename(vscode.env.shell);
monitorTerminal = vscode.window.createTerminal({
name: "ESP-IDF Monitor",
env: modifiedEnv,
cwd: workspaceRoot.fsPath,
shellArgs: [],
shellPath: shellExecutable,
shellPath: vscode.env.shell,
strictEnv: true,
});
}
Expand Down
Loading