Skip to content

Commit

Permalink
fix: destroyed process
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Jun 7, 2023
1 parent 8df4f68 commit be1ed57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/lib/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ async function createTerminal(
}
const ptyProcess = pty.spawn(shell!, runtimeArgs, options)
ptyProcess.onData(data => {
webContents.send('input-terminal', {
pid: ptyProcess.pid,
process: ptyProcess.process,
data,
})
if (!webContents.isDestroyed()) {
webContents.send('input-terminal', {
pid: ptyProcess.pid,
process: ptyProcess.process,
data,
})
}
})
ptyProcess.onExit(data => {
ptyProcessMap.delete(ptyProcess.pid)
Expand Down

0 comments on commit be1ed57

Please sign in to comment.