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 paramfetch dest dir with aria2 #60

Merged
merged 1 commit into from
Jun 17, 2024
Merged
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
10 changes: 5 additions & 5 deletions lib/fastparamfetch/paramfetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ func (ft *fetch) maybeFetchAsync(ctx context.Context, name string, info paramFil
}
err = ft.checkFile(path, info)
if err != nil {
log.Errorf("sanity checking fetched file failed, removing and retrying: %w", err)
log.Errorf("sanity checking fetched file failed, removing and retrying: %+v", err)
// remove and retry once more
err := os.Remove(path)
if err != nil {
if err != nil && !os.IsNotExist(err) {
ft.errs = append(ft.errs, xerrors.Errorf("remove file %s failed: %w", path, err))
return
}
Expand All @@ -173,9 +173,9 @@ func (ft *fetch) maybeFetchAsync(ctx context.Context, name string, info paramFil

err = ft.checkFile(path, info)
if err != nil {
ft.errs = append(ft.errs, xerrors.Errorf("checking file %s failed: %w", path, err))
ft.errs = append(ft.errs, xerrors.Errorf("re-checking file %s failed: %w", path, err))
err := os.Remove(path)
if err != nil {
if err != nil && !os.IsNotExist(err) {
ft.errs = append(ft.errs, xerrors.Errorf("remove file %s failed: %w", path, err))
}
}
Expand Down Expand Up @@ -307,7 +307,7 @@ func fetchWithAria2c(ctx context.Context, out, url string) error {
return xerrors.New("aria2c not found in PATH")
}

cmd := exec.CommandContext(ctx, aria2cPath, "--continue", "-x16", "-s16", "-o", out, url)
cmd := exec.CommandContext(ctx, aria2cPath, "--continue", "-x16", "-s16", "-dir", filepath.Dir(out), "-o", filepath.Base(out), url)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

Expand Down