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
|
||||
#end if
|
||||
#end if
|
||||
' bs:disable-next-line LINT2001
|
||||
continue for
|
||||
end if
|
||||
|
||||
@@ -1103,6 +1104,7 @@ namespace Innertube
|
||||
throw "Unknown content type: " + contentType
|
||||
#end if
|
||||
#end if
|
||||
' bs:disable-next-line LINT2001
|
||||
return invalid
|
||||
end function
|
||||
|
||||
@@ -1520,6 +1522,7 @@ namespace Innertube
|
||||
throw "Unknown content type: " + contentType
|
||||
#end if
|
||||
#end if
|
||||
' bs:disable-next-line LINT2001
|
||||
return invalid
|
||||
end function
|
||||
|
||||
|
||||
+21
-2
@@ -115,6 +115,7 @@ function startTelnetClientAsync(host, port, timeoutSeconds = 2) {
|
||||
};
|
||||
|
||||
connection.on('close', function () {
|
||||
connection.telnetClosed = true;
|
||||
console.log('connection closed');
|
||||
});
|
||||
|
||||
@@ -142,19 +143,37 @@ function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExi
|
||||
let data = '';
|
||||
|
||||
let timeoutID;
|
||||
let settled = false;
|
||||
|
||||
function settle(fn, arg) {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
clearTimeout(timeoutID);
|
||||
fn(arg);
|
||||
}
|
||||
|
||||
function timeoutReached() {
|
||||
reject(`Timeout of ${timeoutSeconds} seconds waiting for ${endToken}`);
|
||||
settle(reject, `Timeout of ${timeoutSeconds} seconds waiting for ${endToken}`);
|
||||
connection.end();
|
||||
}
|
||||
|
||||
function connectionClosed() {
|
||||
settle(reject, `Connection closed before ${endToken}`);
|
||||
}
|
||||
|
||||
if (connection.telnetClosed) {
|
||||
connectionClosed();
|
||||
return;
|
||||
}
|
||||
connection.on('close', connectionClosed);
|
||||
|
||||
connection.on('data', (chunk) => {
|
||||
process.stdout.write(chunk.toString());
|
||||
clearTimeout(timeoutID);
|
||||
|
||||
data += chunk.toString();
|
||||
if (withoutQuotedLines(data).includes(endToken)) {
|
||||
resolve(data);
|
||||
settle(resolve, data);
|
||||
connection.end();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user