Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: prefer the bundled chdman binaries #27

Merged
merged 5 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/chdman/chdmanBin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
return ChdmanBin.CHDMAN_BIN;
}

const resolved = await which('chdman', { nothrow: true });
if (resolved) {
ChdmanBin.CHDMAN_BIN = resolved;
return resolved;
}

const rootDirectory = await this.findRoot() ?? process.cwd();
const prebuilt = path.join(rootDirectory, 'bin', process.platform, process.arch, `chdman${process.platform === 'win32' ? '.exe' : ''}`);
if (await util.promisify(fs.exists)(prebuilt)) {
ChdmanBin.CHDMAN_BIN = prebuilt;
return prebuilt;
}

const resolved = await which('chdman', { nothrow: true });
if (resolved) {
ChdmanBin.CHDMAN_BIN = resolved;
return resolved;
}

return undefined;
}

Expand All @@ -72,7 +72,7 @@

proc.stdout.on('data', (chunk) => {
if (options?.logStd) {
console.log(chunk.toString());

Check warning on line 75 in src/chdman/chdmanBin.ts

View workflow job for this annotation

GitHub Actions / node-lint

Unexpected console statement
}

chunks.push(chunk);
Expand All @@ -80,7 +80,7 @@

proc.stderr.on('data', (chunk) => {
if (options?.logStd) {
console.error(chunk.toString());

Check warning on line 83 in src/chdman/chdmanBin.ts

View workflow job for this annotation

GitHub Actions / node-lint

Unexpected console statement
}

chunks.push(chunk);
Expand Down
2 changes: 1 addition & 1 deletion src/chdman/chdmanInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default {
// Try to detect failures, and then retry them automatically
if (chdInfo.fileVersion === 0 && attempt < 3) {
await new Promise((resolve) => {
setTimeout(resolve, Math.random() * (2 ** (attempt - 1) * 10));
setTimeout(resolve, Math.random() * (2 ** (attempt - 1) * 20));
});
return this.info(options, attempt + 1);
}
Expand Down
Loading