quick ci fix
This commit is contained in:
1 parent
7c6df7173c
commit
87b4906022
2 files changed
+24
-2
No files matched your search
@@ -31,6 +31,7 @@ namespace Innertube
|
|||||||
throw "Unknown node: " + key
|
throw "Unknown node: " + key
|
||||||
#end if
|
#end if
|
||||||
#end if
|
#end if
|
||||||
|
' bs:disable-next-line LINT2001
|
||||||
continue for
|
continue for
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1103,6 +1104,7 @@ namespace Innertube
|
|||||||
throw "Unknown content type: " + contentType
|
throw "Unknown content type: " + contentType
|
||||||
#end if
|
#end if
|
||||||
#end if
|
#end if
|
||||||
|
' bs:disable-next-line LINT2001
|
||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -1520,6 +1522,7 @@ namespace Innertube
|
|||||||
throw "Unknown content type: " + contentType
|
throw "Unknown content type: " + contentType
|
||||||
#end if
|
#end if
|
||||||
#end if
|
#end if
|
||||||
|
' bs:disable-next-line LINT2001
|
||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
+21
-2
@@ -115,6 +115,7 @@ function startTelnetClientAsync(host, port, timeoutSeconds = 2) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
connection.on('close', function () {
|
connection.on('close', function () {
|
||||||
|
connection.telnetClosed = true;
|
||||||
console.log('connection closed');
|
console.log('connection closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -142,19 +143,37 @@ function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExi
|
|||||||
let data = '';
|
let data = '';
|
||||||
|
|
||||||
let timeoutID;
|
let timeoutID;
|
||||||
|
let settled = false;
|
||||||
|
|
||||||
|
function settle(fn, arg) {
|
||||||
|
if (settled) return;
|
||||||
|
settled = true;
|
||||||
|
clearTimeout(timeoutID);
|
||||||
|
fn(arg);
|
||||||
|
}
|
||||||
|
|
||||||
function timeoutReached() {
|
function timeoutReached() {
|
||||||
reject(`Timeout of ${timeoutSeconds} seconds waiting for ${endToken}`);
|
settle(reject, `Timeout of ${timeoutSeconds} seconds waiting for ${endToken}`);
|
||||||
connection.end();
|
connection.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function connectionClosed() {
|
||||||
|
settle(reject, `Connection closed before ${endToken}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connection.telnetClosed) {
|
||||||
|
connectionClosed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
connection.on('close', connectionClosed);
|
||||||
|
|
||||||
connection.on('data', (chunk) => {
|
connection.on('data', (chunk) => {
|
||||||
process.stdout.write(chunk.toString());
|
process.stdout.write(chunk.toString());
|
||||||
clearTimeout(timeoutID);
|
clearTimeout(timeoutID);
|
||||||
|
|
||||||
data += chunk.toString();
|
data += chunk.toString();
|
||||||
if (withoutQuotedLines(data).includes(endToken)) {
|
if (withoutQuotedLines(data).includes(endToken)) {
|
||||||
resolve(data);
|
settle(resolve, data);
|
||||||
connection.end();
|
connection.end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user