@travetto/exec
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -17,3 +17,3 @@ { | ||
}, | ||
"version": "0.0.34" | ||
"version": "0.0.35" | ||
} |
@@ -25,2 +25,29 @@ import * as child_process from 'child_process'; | ||
static async waitForPort(port: number, ms = 5000) { | ||
const start = Date.now(); | ||
while ((Date.now() - start) < ms) { | ||
try { | ||
await new Promise((res, rej) => { | ||
try { | ||
const sock = net.createConnection(port, 'localhost', (err: any, succ: any) => { | ||
if (err) { | ||
rej(err); | ||
} else { | ||
sock.destroy(); | ||
res(succ); | ||
} | ||
}); | ||
sock.on('error', rej); | ||
} catch (e) { | ||
rej(e); | ||
} | ||
}); | ||
return; | ||
} catch (e) { | ||
await new Promise(res => setTimeout(res, 50)); | ||
} | ||
} | ||
throw new Error('Could not acquire port'); | ||
} | ||
private cmd: string = 'docker'; | ||
@@ -114,29 +141,2 @@ private _proc: CommonProcess; | ||
async waitForPort(port: number, ms = 5000) { | ||
const start = Date.now(); | ||
while ((Date.now() - start) < ms) { | ||
try { | ||
await new Promise((res, rej) => { | ||
try { | ||
const sock = net.createConnection(port, 'localhost', (err: any, succ: any) => { | ||
if (err) { | ||
rej(err); | ||
} else { | ||
sock.destroy(); | ||
res(succ); | ||
} | ||
}); | ||
sock.on('error', rej); | ||
} catch (e) { | ||
rej(e); | ||
} | ||
}); | ||
return; | ||
} catch (e) { | ||
await new Promise(res => setTimeout(res, 50)); | ||
} | ||
} | ||
throw new Error('Could not acquire port'); | ||
} | ||
getFlags(extra?: string[]) { | ||
@@ -143,0 +143,0 @@ const flags = []; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22626