fix: buffer SSH readiness confirmation
This commit is contained in:
@@ -256,8 +256,13 @@ export function createConcreteDiagnosticAdapters(
|
||||
dependencies.sshForwardConfirmed
|
||||
? dependencies.sshForwardConfirmed(tunnel, signal)
|
||||
: new Promise<void>((resolve, reject) => {
|
||||
let stderrBuffer = "";
|
||||
const confirmation = new RegExp(`Local forwarding listening on 127\\.0\\.0\\.1 port ${port}\\.?`);
|
||||
const confirm = (data: Buffer | string) => {
|
||||
if (new RegExp(`Local forwarding listening on 127\\.0\\.0\\.1 port ${port}\\.?`).test(data.toString())) {
|
||||
stderrBuffer = `${stderrBuffer}${data.toString()}`.slice(-4096);
|
||||
const lines = stderrBuffer.split(/\r?\n/);
|
||||
stderrBuffer = lines.pop() ?? "";
|
||||
if (lines.some((line) => confirmation.test(line))) {
|
||||
child.stderr?.off?.("data", confirm);
|
||||
resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user