Skip to content

Commit

Permalink
Fix: Terminal Closure Does Not Clean up Instrument (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
esarver authored Jul 31, 2024
1 parent e69c8d2 commit afbb658
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [0.17.0]

### Added
- Reset instrument if closed unexpectedly using the trashcan on the terminal (TSP-730)
- Add logging for terminal and discover
- Default friendly name if user doesn't provide one (TSP-757)

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
},
"dependencies": {
"@tektronix/keithley_instrument_libraries": "0.16.0",
"@tektronix/kic-cli": "0.17.0-1",
"@tektronix/kic-cli": "0.17.0-2",
"@tektronix/web-help-documents": "0.15.3",
"@types/cheerio": "^0.22.35",
"cheerio": "^1.0.0-rc.12",
Expand Down
18 changes: 18 additions & 0 deletions src/resourceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,24 @@ export class KicCell extends EventEmitter {
})
}

vscode.window.onDidCloseTerminal((t) => {
if (
t.creationOptions.iconPath !== undefined &&
t.creationOptions.iconPath.toString().search("keithley-logo") &&
t.exitStatus !== undefined &&
t.exitStatus.reason !== vscode.TerminalExitReason.Process
) {
setTimeout(() => {
child.spawnSync(EXECUTABLE, [
"-v",
"reset",
connType,
unique_id,
])
}, 500)
}
})

this.terminalPid = this._term.processId

if (this._term != undefined) {
Expand Down

0 comments on commit afbb658

Please sign in to comment.