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

No version or --help output from windows browsers #7

Closed
caspervonb opened this issue Aug 2, 2015 · 16 comments
Closed

No version or --help output from windows browsers #7

caspervonb opened this issue Aug 2, 2015 · 16 comments
Labels

Comments

@caspervonb
Copy link
Owner

$ chrome.exe --version
# no output, instead the browser is launched.
$ firefox --version
# no output, no launch.

Which breaks the new behavior of type introduced in b7806a1

@caspervonb caspervonb added the bug label Aug 2, 2015
@stereokai
Copy link

Will have a look when I'm home. Where is the code that calls this?

@caspervonb
Copy link
Owner Author

It's in type which yields the type of the browser, https://github.com/caspervonb/node-browser_process/blob/master/lib/index.js#L74

@stereokai
Copy link

Got it. Will look at it later.

@caspervonb
Copy link
Owner Author

Firefox does pass the tests tho so it's not an issue as it works fine, I'm just not getting it to print to stdout in a cmd.exe for whatever reason which is a bit of a what the hell is going on here moment but i'll just write it up to my inexperience with the cmd shell.

@stereokai
Copy link

Have you tried Powershell?

@caspervonb
Copy link
Owner Author

Yeah same results as above in the issue (which where from cmd.exe shell).

@stereokai
Copy link

I don't know yet. I'll have a look at home. Do you have the latest Chrome?

@caspervonb
Copy link
Owner Author

Do you have the latest Chrome?

How can I test the version? 😀

But same results with both chrome and chromium, latest'ish (44 or so).

Noticing that the executable behaves differently than on unix, on mac and linux the executable is blocking, killing it will kill the tab.

On windows, it just returns immediately.

@stereokai
Copy link

You can check in Chrome -> About.

That's weird, when I terminated amok, my chrome quitted.

@caspervonb
Copy link
Owner Author

You can check in Chrome -> About.

I know, just found it amusing in an issue about --version not working 😄
Based on the folder names its 45.0 46.0.

@stereokai
Copy link

Yeah :D

Alright so I'll have a look when I'm home.

@stereokai
Copy link

@caspervonb I got you covered bro.

chrome --version flag/switch is not supported on Windows: https://code.google.com/p/chromium/issues/detail?id=158372

But when there's a will, there's a way. The version number is stored in the registry in the uninstall information. So we can query it via the command line, as per the example in the above link:

reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v DisplayVersion

However, this did not work for me. The reason being - the key does not exist. My immediate assumption was that in the 2 years since this idea was suggested, Google has released the 64bit version of Chrome, so, a registry scour was in order. Eventually I have found my target:

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v DisplayVersion

Which outputs:

DisplayVersion    REG_SZ    44.0.2403.125

Which you can parse with a regex to get the version number. To strike out all possible fail points, I suggest you check the original 32bit query on a 32bit Chrome installatation - and in your code, you could try one and if it fails, try the other. They are bound to succeed, because this information must be in the registry - unless someone is using Chrome in a hackish portable way, and I don't even know if that is even possible or something you should care about.

@caspervonb
Copy link
Owner Author

All right that's a shame, was hoping of using --version as an agnostic way to identify the browser name and version without resolving to platform specific things like the registry.

Think I'll revert to just using the basename of the default paths for matching the type, otherwise it'll become too complex with branching logic etc when it should just be a simple lookup.

For detect, which is yet to be implemented however this is gold 👍, need to report browser name, type, version, path, etc.

@stereokai
Copy link

Well, I'm happy I could help with something..

@caspervonb
Copy link
Owner Author

Rebased a little on master, I know I know but with 0 forks and 0 current branches its fine, really.

Now if the executable name is the default one, it'll figure out the type but, there are failures which the commit was supposed to fix which is things like Google\ Chrome\ Canary which is the executable name of canary on OS X.

But, separate issue.

Thanks for the digging @stereokai 😀

@stereokai
Copy link

F***ing A man :)

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

No branches or pull requests

2 participants