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

[Windows] Have a single instance of Agent Manager #1924

Merged
merged 2 commits into from
Sep 17, 2015

Conversation

elafarge
Copy link
Contributor

When the GUI is started:
- It checks for a Pidfile left by a previously running (and potentially still running) GUI
- If such a Pidfile was found and if the Pid inside is file is indeed the Pid of a running instance of agent-manager.exe, then let's kill that old process
- Let's write the Pid of the current process to that pidfile

Nothing else was changed :)

@elafarge elafarge force-pushed the etienne/windows-singleton-manager branch from e978acd to c2f3031 Compare September 16, 2015 01:40
avoids multiple icons in the Tray on Windows. On OSX, we don't have to do anything: icons
don't get duplicated. """
# On Windows, if a window is already opened, let's just bring it on the foreground
if Platform.is_windows():
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicking but you could check that before calling the function. That would avoid opening a new context for nothing if the platform is not Windows (and wrapping the whole thing in a big if).

Copy link
Member

Choose a reason for hiding this comment

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

You are testing Platform.is_windows() two times.

@hkaj
Copy link
Member

hkaj commented Sep 17, 2015

Great success @elafarge! Except for a few nitpick I don't have much to say. Feel free to merge once you've considered the 2 comments.

Unfortunately I can't squash this commit into the previous one since the
branch has already been merged into the `etienne/windows-omnibus4`
branch.
@elafarge
Copy link
Contributor Author

Thanks @hkaj :) I took your remarks into account. I'm right now building a Windows version of the Agent to run some tests. If it still works as expected, I'll merge that once and for all ;-)

@elafarge
Copy link
Contributor Author

@yannmh I was wrong, since we're using the 5.5.x branch of the Agent, this is not gonna be shipped with the 5.5.0 by default. It can be an interesting set commits to cherrypick for the next bugfix release though ;-)

elafarge added a commit that referenced this pull request Sep 17, 2015
[Windows] Have a single instance of Agent Manager
@elafarge elafarge merged commit ff669c3 into master Sep 17, 2015
@tmichelet
Copy link
Contributor

@elafarge don't forget to delete branches once merged

@elafarge elafarge deleted the etienne/windows-singleton-manager branch September 18, 2015 15:16
@@ -791,7 +799,52 @@ def info_popup(message, parent=None):
QMessageBox.information(parent, 'Message', message, QMessageBox.Ok)


def kill_old_process():
""" Kills or brings to the foreground (if possible) any other instance of this program. It
Copy link
Member

Choose a reason for hiding this comment

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

or brings to the foreground (if possible) any other instance of this program

It looks like you actually always kill the previous instance in fact.

@yannmh
Copy link
Member

yannmh commented Sep 18, 2015

I know it has been merged, but I think killing the process rather than bringing the UI back is dangerous: for instance, any change made to a configuration file without saving would be lost.

@elafarge
Copy link
Contributor Author

Oh yeah, actually it doesn't kill the process if the Window is opened, at least not on Windows server 2012: if an application is in the taskbar, starting it again from the launch menu will just bring the window to the front. I don't know if that behaviour is the same on Windows 7 likes (ie Windows server 2008).

@elafarge
Copy link
Contributor Author

@yannmh ^^

@olivielpeau olivielpeau modified the milestones: 5.5.1, 5.6.0 Sep 21, 2015
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

Successfully merging this pull request may close these issues.

5 participants