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] EBUSY during download cancel #783

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[Fix] EBUSY during download cancel #783

wants to merge 1 commit into from

Conversation

BrettCleary
Copy link
Collaborator

Removing the directory when canceling an in progress download was being called twice and failing with EBUSY. Selecting to keep the files would still attempt to delete them.

TBD how to handle cancel during extraction with Yes/No to keeping download files.

@BrettCleary BrettCleary self-assigned this Mar 5, 2024
@@ -84,8 +84,8 @@ export const handleDMQueueInformation = (
export const cancelDownload = (removeDownloaded: boolean) =>
ipcRenderer.send('cancelDownload', removeDownloaded)

export const cancelExtraction = (appName: string) =>
ipcRenderer.send('cancelExtraction', appName)
export const cancelExtraction = (appName: string, removeDownloaded: boolean) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass an object instead of a flag.

canceExtraction = ({ appName, removeDownloaded }: {appName: string; removeDownloaded: boolean }) => {...}

@@ -0,0 +1,42 @@
import fs from 'fs'

export function deleteFolderRecursive(path: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using rmSync with recursive flag?

fs.rmSync(dir, { recursive: true, force: true });

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work unfortunately. only works if the folder is already empty

tried all the solutions from https://stackoverflow.com/questions/18052762/remove-directory-which-is-not-empty and this is the only one that worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants