fix: 修复 node-pty offData/offExit 方法名错误

This commit is contained in:
2026-03-20 13:07:13 +08:00
parent 1829e4d9a6
commit 099cf1c899
2 changed files with 4 additions and 4 deletions

View File

@@ -138,8 +138,8 @@ function setupTerminalAPI(app) {
res.write(`data: ${JSON.stringify({ type: 'connected' })}\n\n`);
req.on('close', () => {
session.pty.offData(dataHandler);
session.pty.offExit(exitHandler);
session.pty.removeListener('data', dataHandler);
session.pty.removeListener('exit', exitHandler);
});
});

View File

@@ -154,8 +154,8 @@ app.get('/api/terminal/:sessionId/stream', (req, res) => {
// Handle client disconnect
req.on('close', () => {
session.pty.offData(dataHandler);
session.pty.offExit(exitHandler);
session.pty.removeListener('data', dataHandler);
session.pty.removeListener('exit', exitHandler);
console.log(`Client disconnected: session=${sessionId} client=${clientId}`);
});
});