( archivePath, destPath, expectedNames, targetName, runFile = execFileSync, spawnFile = spawn, )
| 209 | } |
| 210 | |
| 211 | async function extractExactTarArchive( |
| 212 | archivePath, destPath, expectedNames, targetName, |
| 213 | runFile = execFileSync, spawnFile = spawn, |
| 214 | ) { |
| 215 | requireRegularArchive(archivePath); |
| 216 | // The exact root namespace is the member bound: the listing must name |
| 217 | // exactly the expected root files. |
| 218 | const listing = runFile('tar', ['-tzf', archivePath], { |
| 219 | encoding: 'utf8', |
| 220 | windowsHide: true, |
| 221 | }); |
| 222 | validateExactTarMemberListing(listing, expectedNames); |
| 223 | // Only the fixed root executable is ever written; the companions are |
| 224 | // listed but never extracted. |
| 225 | const target = path.join(destPath, targetName); |
| 226 | await extractTarMember(archivePath, target, targetName, spawnFile); |
| 227 | fs.chmodSync(target, 0o755); |
| 228 | } |
| 229 | |
| 230 | function downloadHop(url, dest, loopback) { |
| 231 | return new Promise((resolve, reject) => { |
no test coverage detected