Skip to content

Commit 85c6878

Browse files
authored
Merge pull request #261 from JunoLab/sp/resizeerrorhandling
gracefully handle terminal resize errors
2 parents 4ddee78 + 5e44871 commit 85c6878

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/console/console.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,16 @@ export default class InkTerminal extends PaneItem {
258258
let {cols, rows} = this.fitAddon.proposeDimensions()
259259
// slightly narrower terminal looks better:
260260
cols -= 1
261+
if (cols < 1) cols = 1
261262
if (this.terminal && !isNaN(cols) && !isNaN(rows)) {
262263
this.terminal.resize(cols, rows)
263264
if (this.ty && this.ty.resize) {
264-
this.ty.resize(cols, rows)
265+
try {
266+
this.ty.resize(cols, rows)
267+
} catch (err) {
268+
// the pty can apparently die before the resize event goes through (https://github.com/JunoLab/atom-julia-client/issues/687)
269+
console.error(err)
270+
}
265271
}
266272
}
267273
}

0 commit comments

Comments
 (0)