Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix new JAVA_HOME spec failure on Windows.

Also, pop-up Dialogs *only* when there is no console attached,
otherwise print out the message to the stderr, in sync with *nix launcher.
  • Loading branch information...
commit 020022e6feef4fc15de7e88f8f8e46f6eadc2813 1 parent b5517ec
@vvs authored
View
29 platformlauncher.cpp
@@ -42,6 +42,7 @@
* Author: Tomas Holy
*/
+#include <stdio.h>
#include "utilsfuncs.h"
#include "platformlauncher.h"
#include "rb_w32_cmdvector.h"
@@ -188,11 +189,17 @@ bool PlatformLauncher::run(DWORD *retCode) {
bool PlatformLauncher::checkJDKHome() {
if (!jdkhome.empty() && !jvmLauncher.initialize(jdkhome.c_str())) {
logMsg("Cannot locate java installation in specified jdkhome: %s", jdkhome.c_str());
- string errMsg = "Cannot locate java installation in specified jdkhome:\n";
+ string errMsg = "ERROR: Cannot locate Java installation in specified jdkhome:\n";
errMsg += jdkhome;
- errMsg += "\nDo you want to try to use default version?";
+ string errMsgFull = errMsg + "\nDo you want to try to use default version?";
jdkhome = "";
- if (::MessageBox(NULL, errMsg.c_str(), "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
+ // Pop-up the message box only if there is no console
+ if (!isConsoleAttached()) {
+ if (::MessageBox(NULL, errMsgFull.c_str(), "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
+ return false;
+ }
+ } else {
+ fprintf(stderr, "%s\n", errMsg.c_str());
return false;
}
}
@@ -203,13 +210,19 @@ bool PlatformLauncher::checkJDKHome() {
if (javaHome) {
logMsg("%%JAVA_HOME%% is set: %s", javaHome);
if (!jvmLauncher.initialize(javaHome)) {
- logMsg("Cannot locate java installation, specified by JAVA_HOME: %s", javaHome);
- string errMsg = "Cannot locate java installation, specified by JAVA_HOME:\n";
+ logMsg("ERROR: Cannot locate java installation, specified by JAVA_HOME: %s", javaHome);
+ string errMsg = "Cannot locate Java installation, specified by JAVA_HOME:\n";
errMsg += javaHome;
- errMsg += "\nDo you want to try to use default version?";
+ string errMsgFull = errMsg + "\nDo you want to try to use default version?";
jdkhome = "";
- if (::MessageBox(NULL, errMsg.c_str(),
- "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
+ // Pop-up the message box only if there is no console
+ if (!isConsoleAttached()) {
+ if (::MessageBox(NULL, errMsgFull.c_str(),
+ "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
+ return false;
+ }
+ } else {
+ fprintf(stderr, "%s\n", errMsg.c_str());
return false;
}
} else {
View
6 spec/launcher_spec.rb
@@ -15,7 +15,11 @@
it "should use $JAVA_HOME/bin/java when JAVA_HOME is specified" do
with_environment "JAVA_HOME" => File.join("some", "java", "home") do
- jruby_launcher_args("-v").first.should == File.join("some", "java", "home", "bin", "java")
+ if (windows?)
+ jruby_launcher_args("-v 2>&1").join.should =~ %r{some/java/home}
+ else
+ jruby_launcher_args("-v").first.should == File.join("some", "java", "home", "bin", "java")
+ end
end
end
View
5 spec/spec_helper.rb
@@ -8,6 +8,7 @@
module JRubyLauncherHelper
JRUBY_EXE = File.expand_path("../../jruby", __FILE__) + Config::CONFIG['EXEEXT']
+ WINDOWS = Config::CONFIG['target_os'] =~ /mswin/
def self.check_executable_built
unless File.executable?(JRUBY_EXE)
@@ -27,6 +28,10 @@ def last_exit_code
$?.exitstatus
end
+ def windows?
+ WINDOWS
+ end
+
def with_environment(pairs = {})
prev_env = {}
pairs.each_pair do |k,v|
Please sign in to comment.
Something went wrong with that request. Please try again.