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

Detect is emitter already running #32

Open
ArmorDarks opened this issue Jul 24, 2017 · 6 comments
Open

Detect is emitter already running #32

ArmorDarks opened this issue Jul 24, 2017 · 6 comments

Comments

@ArmorDarks
Copy link

Thanks for the lib!

I wonder, is it possible somehow to detect is emitter already running? Or make so that invoking emitter second time (when it is already running) will not fail and simple ignore invocation?

@i8degrees
Copy link

@ArmorDarks You sure could. Most unix init scripts do just that. (edge cases, but alas!)

Log the process ID of the emitter (or perhaps the parent in which launched it, however you prefer) to a file after forking the chokidar emitter. future executions simply involve a check against this logged PID to decide whether or not to fail and terminate before a further launch.

@ArmorDarks
Copy link
Author

@i8degrees Thanks! Though, wow, that sounded slightly more complicated than it should be...

Anyway, I guess this library isn't maintained anyway, so there little chances that it will be extended or a PR will be accepted, right, @capaj?

@capaj
Copy link
Owner

capaj commented Dec 9, 2017

@ArmorDarks I haven't touched this codebas in quite a while, but I will certainly merge a PR if you make it well. Feel free to update dependencies as well while you're at it.

@ArmorDarks
Copy link
Author

@capaj Thanks for the reply! I'll try to investigate how to do this since I do not have a clear picture yet. @i8degrees give me a good path to watch, but still, there are some things to be figured out...

@i8degrees
Copy link

i8degrees commented Dec 9, 2017

@ArmorDarks nods I thought the same myself for many years! It is actually a rather clever, simple design that is proven the test of time.

I kept this list short, so to try a gentle introduction. You will often find in OSS server distributions a contrib directory that contains process scripts for various platforms. This would be an excellent place to start looking for reference implementation details. Sorry, no distribution name comes to mind, but you'll find a plethora in FreeBSD ports.

Good luck!

P.S. Remember, what is important (generally speaking, perhaps not in your case?) are emitters that you depend on, so that you can keep from touching third-party emitters that may be running. This is one reason how PID lists can be nice.

@ArmorDarks
Copy link
Author

The necessity of disk operation is no-go for me since it will impact our build system performance, which means the harder time during development. But thanks for the lead, I will look into it.

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

No branches or pull requests

3 participants