Bug 313819 - [launcher] option to turn off error messages completely
Summary: [launcher] option to turn off error messages completely
Status: NEW
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Launcher (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-20 17:52 EDT by Vlad Zahariev CLA
Modified: 2013-11-10 22:31 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vlad Zahariev CLA 2010-05-20 17:52:25 EDT
Build Identifier: Eclipse 3.6 20100506-2000

IN silent mode the launcher of Eclipse 3.6 (M7) incorrectly prints out all the command line arguments passed to the Java code. This happens despite the fact that the --launcher.suppressErrors was used.

This is a regression from previous version of Eclipse launchers and causes serious troubles with the command line operation for Eclipse RCP application. The output is confusing for normal user. 

This output is definitely useful for debug purposes but there must be a way to disable it.


Reproducible: Always

Steps to Reproduce:
1.Download and unzip  to some directory the windows (on windows) version of Eclipse 3.6 M7.
2.In the unzipped eclipse directory create a file named “exec.bat” with the following simple content: “exit 1”
3.	Add to the eclipse.ini file the fooling lines:
-nosplash
--launcher.suppressErrors
-silent
-vm
exec.bat
The goal above  is to simulate silent mode where java process returns an error (non 0) value.
Please note that the --launcher.suppressErrors is used.
4.	Open a DOS prompt in this directory and execute: eclipsec
The output will look like this:
C:\recv\eclipse-java-helios-M7-win32\eclipse>eclipsec

C:\recv\eclipse-java-helios-M7-win32\eclipse>exit 1
Eclipsec:
Java was started but returned exit code=1
C:\recv\eclipse-java-helios-M7-win32\eclipse\exec.bat
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m
-jar C:\recv\eclipse-java-helios-M7-win32\eclipse\plugins/org.eclipse.equinox.la
uncher_1.1.0.v20100419.jar
-os win32
-ws win32
-arch x86
-launcher C:\recv\eclipse-java-helios-M7-win32\eclipse\eclipsec.exe
-name Eclipsec
--launcher.library C:\recv\eclipse-java-helios-M7-win32\eclipse\plugins/org.ecli
pse.equinox.launcher.win32.win32.x86_1.1.0.v20100322-1720\eclipse_1307.dll
-startup C:\recv\eclipse-java-helios-M7-win32\eclipse\plugins/org.eclipse.equino
x.launcher_1.1.0.v20100419.jar
-exitdata 1840_7bc
-product org.eclipse.epp.package.java.product
-silent
-vm C:\recv\eclipse-java-helios-M7-win32\eclipse\exec.bat
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m
-jar C:\recv\eclipse-java-helios-M7-win32\eclipse\plugins/org.eclipse.equinox.la
uncher_1.1.0.v20100419.jar

C:\recv\eclipse-java-helios-M7-win32\eclipse>
This problem is reproducible on other platforms (as Linux) as well.
Comment 1 Andrew Niefer CLA 2010-05-25 12:59:29 EDT
"-silent" is not an argument supported by the eclipse launcher.

This appears to be working as designed, however there was a bug in 3.5 and earlier that prevented the error message from being displayed when the vm failed early.  This was fixed in 3.6 so we do see a change in behaviour.

See bug 209080 comment #21 for the intent of "--launcher.suppressErrors".  The intent is to write the error to stderr instead of displaying the dialog.  An eclipse application can turn off the error messages completely by setting an empty message in the "eclipse.exitdata" java system property.  This requires the vm to have started successfuly.

Bug 291919 comment #4 found the problem where a vm failure before getting to Main always looks like the exit message was turned off.  The result of this was that the error message was not displayed when it should have been.

There was no designed method to completely turn off the error message when we can't even launch the vm.
Comment 2 John Arthorne CLA 2010-05-25 13:07:51 EDT
Vlad, we can either mark this as invalid or reclassify as an enhancement to add the support you are looking for.
Comment 3 Vlad Zahariev CLA 2010-05-25 13:38:33 EDT
Our problem is that our rcp application has a growing support for command line operation.

The application does print a couple of lines with error messages, but they are almost lost (unnoticeable) when followed by the output listed above. I'd guess that this is be a major problem for any RCP application running in command line mode.

Could you recommend any approach allowing us to disable this output  assuming the JRE and the RCP application are executed successfully but the RCP application is returning a non zero code?

If there is no workaround, please reclassify this as an enhancement request.
Comment 4 Thomas Watson CLA 2010-05-25 13:55:17 EDT
(In reply to comment #3)
> Could you recommend any approach allowing us to disable this output  assuming
> the JRE and the RCP application are executed successfully but the RCP
> application is returning a non zero code?
> 

Add the following line to your IApplication.start(IApplicationContext) method before returning your exit code:

		// prevent launcher messages
		System.setProperty(IApplicationContext.EXIT_DATA_PROPERTY, "");
		return exitCode;


In 3.6 we added a new constant for "eclipse.exitdata" which provided javadoc describing what the empty string value is used for:

To suppress all error dialogs displayed by the launcher this property can be 
set to the empty String.  This is useful for 
headless applications where error dialogs must never be displayed.
Comment 5 Vlad Zahariev CLA 2010-05-25 19:26:46 EDT
Thank you Thomas!

This work around can and will be used in our case.
So this bug may be closed.

Maybe there still could be a special command line argument (something like "--launcher.suppressCommandLineErrors") dedicated to this. But at this point that would be a low priority enhancement request.
Comment 6 Thomas Watson CLA 2010-05-26 10:26:40 EDT
(In reply to comment #5)
> Thank you Thomas!
> 
> This work around can and will be used in our case.
> So this bug may be closed.
> 
> Maybe there still could be a special command line argument (something like
> "--launcher.suppressCommandLineErrors") dedicated to this. But at this point
> that would be a low priority enhancement request.

In retrospect --launcher.suppressErrors likely should have been called --launcher.suppressErrorDialogs and the option --launcher.suppressErrors should have been used for disabling all errors (dialogs or console prints etc.)

An option like --launcher.suppressCommandLineErrors is confusing IMO when compared with the current option --launcher.suppressErrors.

Another option is to allow --launcher.suppressErrors to accept an argument

dialog - suppress error dialogs, but print to console.
all - suppress all error indicators

Default value would be "dialog".
Comment 7 Andrew Niefer CLA 2010-05-26 10:57:14 EDT
--launcher.silent is also nice.

This kind of reminds me of how some *nix commands have both "quiet" and "really quiet" options.