From a03c1a8ee491a37544ae75423956599b03332491 Mon Sep 17 00:00:00 2001 From: init Date: Tue, 28 Oct 2025 18:09:33 +0800 Subject: [PATCH] fix bug --- html/src/components/terminal/xterm/index.ts | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/html/src/components/terminal/xterm/index.ts b/html/src/components/terminal/xterm/index.ts index 83b2e56..85d1134 100644 --- a/html/src/components/terminal/xterm/index.ts +++ b/html/src/components/terminal/xterm/index.ts @@ -361,6 +361,19 @@ export class Xterm { } else { clearInterval(this.intervalID); if (data.status === '4') { + fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' + + options.get('user') + + '/' + + options.get('repo') + + '/devcontainer/output?' + + params + ).then(response => response.json()) + .then(data => { + this.writeData(data.output); + }) + .catch(err => { + console.error('[ttyd] Failed to get output:', err); + }); const parts = data.command.split('\n'); this.sendData(parts[0]+"\n"); this.postAttachCommand = parts; @@ -434,20 +447,6 @@ export class Xterm { textDecoder.decode(data).replace(/\s/g, '').includes('Successfully connected to the devcontainer'.replace(/\s/g, '')) ) { this.status = true; - fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' + - options.get('user') + - '/' + - options.get('repo') + - '/devcontainer/output?' + - params - ).then(response => response.json()) - .then(data => { - this.writeData(data.output); - }) - .catch(err => { - console.error('[ttyd] Failed to get output:', err); - }); - } // 连接完成之前,不输出标题和docker命令 if (