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

Limit to single instance #136

Open
4o66 opened this issue Aug 29, 2015 · 4 comments
Open

Limit to single instance #136

4o66 opened this issue Aug 29, 2015 · 4 comments

Comments

@4o66
Copy link
Contributor

4o66 commented Aug 29, 2015

Since KSP-MA saves its config at close, if you accidentally have multiple copies open, your config will be set to the last closed copy.

Need to limit to a single running instance.

@MacTee
Copy link
Owner

MacTee commented Jan 24, 2016

I can realize this for windows easily but i have no idea of how to implment it for the mono verion.

@fbartho
Copy link

fbartho commented Apr 25, 2016

The traditional move is to drop a file on disk with a unique random number.

  1. On app launch, check to see if this file exists. If exists, warn the user that the app is either still running, or didn't quit cleanly. (You can ask user if they want to proceed anyway).
  2. If file is missing, then create with unique number.
  3. On quit, delete this file (if it contains your unique number).

If you want to get fancy, the number you write can be your pid (process-id). Then you can query the system to see if mod-admin is still running with that process-id. If it is still running, you can offer the user the option of force-killing the previous instance (kill -9 <pid>) OR you can bring that process into the foreground.

This level of fancy is called the pidfile technique, while the simpler version is a lock file. Tutorial

@MacTee
Copy link
Owner

MacTee commented Apr 25, 2016

Nice hack with the pid. Thanks!

@HurricanKai
Copy link

Is this done? If not i woud do it ? (New here, But i love this programm, i know a lot of C#, so i wanted to help out :))

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

No branches or pull requests

4 participants