Page 1 of 2
Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 18:39
by bossebengt
I have enabled the single-instance setting in XYplorer. Despite this, I get two instances (I seem unable to create a third one) when launching XYplorer from 2 different command windows.
This is on Windows 10 64-bit with all the latest updates (as of writing), running XYplorer 18.70.0100 in "portable mode."
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 18:45
by highend
I have enabled the single-instance setting in XYplorer
You mean you disabled
Configuration | General | Startup & Exit | Allow multiple instances?
when launching XYplorer from 2 different command windows
How were the command windows invoked, what exactly did you use to startup XY?
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 18:51
by bossebengt
I mean disabled - yes.
The command is set up like this:
Invoking it twice from the samd cmd.exe window starts a single instance. Invoking it from two different cmd.exe windows starts two instances. Invoking it from three different cmd.exe window starts TWO instances (it reactivates the last one started).
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 19:06
by jupe
If you are interested in a temporary workaround
might fix it.
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 19:17
by bossebengt
Adding /flg=2 doesn't fix it. :-(
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 19:27
by jupe
Hmm...it did for me, have you restarted XYplorer since you changed the multiple instances setting? I needed to for it to take effect.
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 19:36
by bossebengt
Ok, so you could reproduce the issue as I described it?
You are correct, it fixes the issue with two cmd.exe windows. However, now I do the following:
1. Start a cmd.exe window
2. Run XY from it
3. Start Sublime Text (or anything else)
4. Run XY from that program
The issue appears just as I described it above. I can create two instances, but no more. I applied the /flg=2 switch both from cmd.exe and Sublime Text.
(I just restarted my computer again before trying this, to make sure)
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 19:58
by jupe
I couldn't/can't reproduce it as you described, what I initially did try was flicking the setting and not restarting and that allowed me to create more than one instance, but when I tried /flg=2 it stopped that from happening, which is why I suggested it as a
temporary workaround.
But once I restarted XY I can't get more than one instance to open, I have tried multiple command prompt windows, launching it directly from my text editor, launching a command prompt from the text editor and then trying to launch it again, I tried admin command prompt etc.
The developer will look into trying to reproduce it on his system when he gets a chance too, but so far I haven't seen it, I am on Win10 x64 latest ver too.
bossebengt wrote:I applied the /flg=2 switch both from cmd.exe and Sublime Text.
On the initial launch from cmd you won't need it. Not that it should make a difference, but if you launch it from a normal shortcut instead of cmd do you see the same behavior?
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 20:01
by bossebengt
So here's what I did now:
1. Start Sublime Text
2. Start XY from Sublime Text
3. Double-click xyplorer.exe
Doing this, I end up with two instances. Trying to launch another one from either one just reactivates the same instance that was previously launched by the respective program.
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 20:21
by bossebengt
Seems I can't fix this. You should look into using mutexes for single instance handling - current method doesn't seem to be working well enough. I'll be buying a lifetime license if this is fixed, but the single-instance fix is crucial for me as I have a tiled window layout with everything I need to see up on my monitors during my work days, so the single-instance feature is actually the main reason for switching away from explorer.exe
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 22:13
by bossebengt
In case it helps in debugging the issue:
I just found out that if I open Help -> About (or any other dialog in XY) in the first instance, no second instance will be started. As long as the dialog is shown in the first instance, it will be activated (as it should).
Re: Problem with XYplorer's single-instance setting
Posted: 11 Feb 2018 23:06
by highend
but the single-instance fix is crucial for me
Use this as a XY launcher in the meantime...
XY_Single instance launcher_v2018-02-12.zip
It checks if an XY window already exists and only if this is NOT the case, it
will launch one. It reads the full command line (Windows API), so you should
be able to use the full palette of what XY supports as command line parameters...
Call it e.g. with:
Code: Select all
"<path to XY_Single instance launcher.exe>" "<path to XYplorer.exe>" <parameters>
Examples:
Suggested: Quote <path to XYplorer.exe>
Code: Select all
"<path to XY_Single instance launcher.exe>" "<path to XYplorer.exe>" /script="::text 'hello';"
Works, as long as the <path to XYplorer.exe> has no spaces in it:
Code: Select all
"<path to XY_Single instance launcher.exe>" <path to XYplorer.exe> /script="::text 'hello';"
Re: Problem with XYplorer's single-instance setting
Posted: 12 Feb 2018 08:16
by bossebengt
So, what's really interesting with the launcher:
1. Calling it with xyplorer_launcher (I renamed it to get rid of spaces) results in it exiting and starting itself over and over (the process gets a new PID over and over so I'm assuming it's exiting and launching itself in an eternal loop)
2. Adding .exe (i.e., calling the launcher with xyplorer_launcher.exe instead of just xyplorer_launcher) fixes this.
3. Calling xyplorer_launcher.exe XYPlorer.exe "c:\some\path" from cmd.exe works fine
4. Calling the exact same command from Sublime Text results in REGULAR Windows File Explorer opening, browsing the path to where XYPlorer.exe is located
What do I do?
EDIT: I should add:
a. There are no spaces in any paths
b. Quotes or not makes no difference
c. Providing the FULL path to XYPlorer.exe or just "XYPlorer.exe" (since it's in the PATH var + same dir as the launcher) makes no difference
EDIT2: More weirdness:
It only opens regular File Explorer if no previous instance of XYPlorer is opened. If it is, the command does absolutely nothing. What I want is for it to activate XYPlorer.exe and browse to the new dir (like it normally does, except I get 2 instances)
Re: Problem with XYplorer's single-instance setting
Posted: 12 Feb 2018 08:37
by bossebengt
Ok, more info:
1. I just bought XYplorer
2. The two instances have different environment variables (though the relevant ones like %userprofile% etc seem to be the same). Can this cause the issue?
3. I'm now using Emacs instead of Sublime Text and I see the same issue
Re: Problem with XYplorer's single-instance setting
Posted: 12 Feb 2018 10:07
by highend
I fixed 01 and 04 from the previous post but I can't just pass the parameters to the launcher like you requested with this:
It only opens regular File Explorer if no previous instance of XYPlorer is opened. If it is, the command does absolutely nothing. What I want is for it to activate XYPlorer.exe and browse to the new dir (like it normally does, except I get 2 instances)
Why not? If you pass a path to XYplorer it won't get accepted if /flg=2 is used. And using /flg=2 is a necessity, otherwise you would have the same
problem as before.
Ofc I can rewrite your path in the parameter list into a script command for XY to execute (which would work with /flg=2).
E.g. you invoked it with:
Code: Select all
"<path to XYplorer>" "<the path to go to>"
then it would look like this after rewriting it:
Code: Select all
"<path to XYplorer>" /script="::goto '<the path to go to>';" /flg=2
This would do exactly what you are requesting.
So... Are you ALWAYS AND ONLY passing a path to XYplorer, when you invoke it?
Otherwise it would be a parsing nightmare if you'd use other options as well...
2. The two instances have different environment variables (though the relevant ones like %userprofile% etc seem to be the same). Can this cause the issue?
Probably yes. Why do your applications get different environments from the OS?