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

feat: provide a mechanism to check if an iroh program is already running #293

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

fabricedesre
Copy link
Contributor

This addresses n0-computer/beetle#211 (and #231)

cc @dignifiedquire : I implemented a non opinionated way to acquire a lock and check its state. The example use in iroh-one works as expected so we can generalize to other binaries if the api is fine.

@dignifiedquire
Copy link
Contributor

General approach looks good to me, just need to make sure the locking works cross platform in some reasonable manners.

@fabricedesre
Copy link
Contributor Author

General approach looks good to me, just need to make sure the locking works cross platform in some reasonable manners.

Do we care about windows? I tested on Mac & Linux so far.

@fabricedesre
Copy link
Contributor Author

@dignifiedquire I switched to https://docs.rs/file-guard/0.1.0/file_guard/ that has the benefits of being cross platform, pure Rust, and to work in our case :) (fslock is not a good fit because its locks are per-handle and not per-process )

@dignifiedquire
Copy link
Contributor

@dignifiedquire I switched to https://docs.rs/file-guard/0.1.0/file_guard/ that has the benefits of being cross platform, pure Rust, and to work in our case :) (fslock is not a good fit because its locks are per-handle and not per-process )

Thanks, looks great.

@b5 b5 self-requested a review October 10, 2022 17:28
b5
b5 previously approved these changes Oct 10, 2022
Copy link
Member

@b5 b5 left a comment

Choose a reason for hiding this comment

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

We've had a proper review from dig, and I've checked that all comments are addressed. Looks good!

@b5 b5 merged commit bddbae9 into n0-computer:main Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants