fix bug
Some checks failed
backend / cross (mips64) (push) Failing after 21m30s
backend / cross (mips64el) (push) Failing after 10s
backend / cross (arm) (push) Failing after 1m33s
backend / cross (mipsel) (push) Failing after 31s
backend / cross (s390x) (push) Failing after 32s
backend / cross (armhf) (push) Failing after 1m33s
backend / cross (win32) (push) Failing after 31s
backend / cross (x86_64) (push) Failing after 31s
docker / build (push) Failing after 36s
backend / cross (i686) (push) Failing after 31s
backend / cross (aarch64) (push) Failing after 13m18s
backend / cross (mips) (push) Failing after 22m12s
Some checks failed
backend / cross (mips64) (push) Failing after 21m30s
backend / cross (mips64el) (push) Failing after 10s
backend / cross (arm) (push) Failing after 1m33s
backend / cross (mipsel) (push) Failing after 31s
backend / cross (s390x) (push) Failing after 32s
backend / cross (armhf) (push) Failing after 1m33s
backend / cross (win32) (push) Failing after 31s
backend / cross (x86_64) (push) Failing after 31s
docker / build (push) Failing after 36s
backend / cross (i686) (push) Failing after 31s
backend / cross (aarch64) (push) Failing after 13m18s
backend / cross (mips) (push) Failing after 22m12s
This commit is contained in:
@@ -103,11 +103,12 @@ export class Xterm {
|
||||
private closeOnDisconnect = false;
|
||||
private intervalID: NodeJS.Timeout;
|
||||
private writeFunc = (data: ArrayBuffer) => this.writeData(new Uint8Array(data));
|
||||
private status = false;
|
||||
private connectStatus = false;
|
||||
private hostTitle = "";
|
||||
private postAttachCommand = [];
|
||||
private postAttachCommandStatus = false;
|
||||
private workdir = "";
|
||||
private containerStatus = "";
|
||||
private beforeCommand?: string;
|
||||
constructor(
|
||||
private options: XtermOptions,
|
||||
@@ -187,7 +188,7 @@ export class Xterm {
|
||||
register(
|
||||
terminal.onData(data =>
|
||||
{
|
||||
if (this.status) {
|
||||
if (this.connectStatus) {
|
||||
sendData(data);
|
||||
} else {
|
||||
this.writeData('\b \b');
|
||||
@@ -267,7 +268,7 @@ export class Xterm {
|
||||
|
||||
@bind
|
||||
public changeStatus(v: boolean){
|
||||
this.status = v;
|
||||
this.connectStatus = v;
|
||||
}
|
||||
|
||||
@bind
|
||||
@@ -357,7 +358,10 @@ export class Xterm {
|
||||
this.workdir = data.workdir;
|
||||
}
|
||||
if (data.status !== '4' && data.status !== '0') {
|
||||
this.sendData(data.command);
|
||||
if(this.containerStatus !== data.status){
|
||||
this.sendData(data.command);
|
||||
}
|
||||
this.containerStatus = data.status;
|
||||
} else {
|
||||
clearInterval(this.intervalID);
|
||||
if (data.status === '4') {
|
||||
@@ -438,19 +442,19 @@ export class Xterm {
|
||||
this.hostTitle = textDecoder.decode(data).replace(/\s/g, '');
|
||||
}
|
||||
// 检测是否退出devcontainer,标题等于host的标题
|
||||
if (this.status && textDecoder.decode(data).replace(/\s/g, '').includes(this.hostTitle)){
|
||||
this.status = false
|
||||
if (this.connectStatus && textDecoder.decode(data).replace(/\s/g, '').includes(this.hostTitle)){
|
||||
this.connectStatus = false
|
||||
}
|
||||
// this.status = true 连接完成
|
||||
// this.connectStatus = true 连接完成
|
||||
if (
|
||||
this.status === false &&
|
||||
this.connectStatus === false &&
|
||||
textDecoder.decode(data).replace(/\s/g, '').includes('Successfully connected to the devcontainer'.replace(/\s/g, ''))
|
||||
) {
|
||||
this.status = true;
|
||||
this.connectStatus = true;
|
||||
}
|
||||
// 连接完成之前,不输出标题和docker命令
|
||||
if (
|
||||
!(this.status === false && (textDecoder.decode(data).includes('\x1b') || textDecoder.decode(data).replace(/\s/g, '').includes('docker')))
|
||||
!(this.connectStatus === false && (textDecoder.decode(data).includes('\x1b') || textDecoder.decode(data).replace(/\s/g, '').includes('docker')))
|
||||
){
|
||||
this.writeFunc(data);
|
||||
fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' +
|
||||
@@ -468,7 +472,7 @@ export class Xterm {
|
||||
console.error('[ttyd] Failed to send output:', err);
|
||||
});
|
||||
}
|
||||
if (this.status && textDecoder.decode(data).replace(/\s/g, '').includes(this.workdir) && !this.postAttachCommandStatus){
|
||||
if (this.connectStatus && textDecoder.decode(data).replace(/\s/g, '').includes(this.workdir) && !this.postAttachCommandStatus){
|
||||
for (let i = 1; i < this.postAttachCommand.length; i++){
|
||||
this.sendData(this.postAttachCommand[i]+"\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user