Closed TheLeoP closed 8 months ago
Is this approach ok? I'm not sure about how the initial command are handled (I tried to use coroutines, but got an error because they can't be used across c call boundaries). Also, the API isn't trash specific, would an trash specific API be preffered?
I didn't undestand how _consume
was suppossed to work inside the on_stdout
callback and your comment made it click for me. This allowed me to simplify the initialization code a lot. Is it better? Or would it still be preffered to extract it into a different file?
I shuffled around some of the logic. LMK if this makes sense (and if it still works for you)
Looks good to me and it's working as expected c:
As mentioned in #243, trash support on windows is slow for some operations because it spawns a powershell process for every operation (sending 10 files to trash would spawn 10 powershell instances).
This PR starts two powershell intances (one for listing and one for deleting) and communicates with them over stdio (sending 10 files to trash now spawns only 1 powershell instance).
This improves the performance of trash related operations in windows after the first operation (because it's neccesary to start the powershell instance the first time). Maybe it could be preffered to start the powershell instances on startup instead (?).