aus-der-Technik / FileMonitor

Watch for file changes in a directory with a unified API on Linux and macOS.
MIT License
30 stars 8 forks source link

Adds support for AsyncStream #4

Closed mcritz closed 3 months ago

mcritz commented 3 months ago

This PR:

Benefits: Users can change callback based system with for await event in fileMonitor.stream { ... }

Drawbacks: I have forced the Package to use Swift 5.9 instead of using #available or @available. We could use an availability check to avoid breaking backward compatibility. OR we could release a new, breaking release of this Package using Github releases.

I’m open to either approach, but we should pick one.

mcritz commented 3 months ago

@petershaw Any interest in taking this change?

tklae commented 3 months ago

Thanks for adding this and sorry for the late reply, somehow we missed it... We will have a look and get back to you, soon!

KrisSimon commented 3 months ago

Hey @mcritz I am totally fine with a change to the swift 5.9 dependency!

I'll manage to take a look to the implementation at the beginning of next week. Pretty cool at the first look! Thank you very much for contribution.

KrisSimon commented 3 months ago

On Linux the FileMonitorTests.testLifecycleChange hangs. @mcritz can you take a look into it?

KrisSimon commented 3 months ago

@mcritz I split test into two and fixed the problem. Let's wait for the CI confirmation. ;)

mcritz commented 3 months ago

@KrisSimon Thanks for fixing that. Happy to have made a contribution!

KrisSimon commented 3 months ago

@mcritz thank you very much for your contribution.