achuanle / umlet

Automatically exported from code.google.com/p/umlet
0 stars 0 forks source link

umlet convert action should return with none 0 exit code when error occurs #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.run umlet.exe -action=convert -format=png -filename=path/to/notExistModelFile

What is the expected output? What do you see instead?
Expected: error message in stderr, and exit code should not = 0
Instead: no error message, exit code is 0

What version of the product are you using? On what operating system?
windows 6 java 7.0.03 x64

Please provide any additional information below.
directly run with 'java -jar umlet.jar' works

Original issue reported on code.google.com by dant...@gmail.com on 28 Aug 2012 at 7:11

GoogleCodeExporter commented 9 years ago
unfortunately (as far as I know) we must decide if we want to create the exe as 
a console application or window application.
The window application doesn't interfere with a currently opened or not opened 
console (if I start it from the explorer, no console will open, if I start it 
from the console, it will NOT kill the console if I close Umlet). Unfortunately 
the window application doesn't return an exit code.

Switching to a console application would help, but then starting umlet would 
also always start a console in the background which we don't want. And if I 
close this console within the program code of the exe, it would also close a 
manually opened console from which you have started umlet.

Therefore we decided to not take action on this, because the exe is mainly a 
help for people who do not use the console and want to quickly start the 
program.
If you need the exit code, please use "java -jar umlet.jar" to start the 
program.

If you have a working solution feel free to add a comment :)

(just for documentation some code parts which I thought would help)
Code to kill the console for console applications: 
http://stackoverflow.com/questions/14416982/in-a-wpf-app-how-do-you-override-the
-console-close-command

Code to return the exit code from the jar with the exe:
proc.WaitForExit();
int exitCode = proc.ExitCode;
proc.Close();
Environment.Exit(exitCode);

Original comment by AFDiaX on 22 Jun 2013 at 2:27