Krun options

**please review**

* use JCommander for krun
* clean up krun frontend to be more generic
* fix some hacky behavior in some of the options
Well, this is actually kind of a funny case. The standard code pattern here
is to check the debug flag and print the stack trace only if it's true. But
this shutdown hook is only created if debug is false. So printing a stack
trace actually is appropriate here. Otherwise you couldn't ever get this
stack trace. But I agree that some kind of "please file this as a bug"
message is appropriate for uncaught exceptions. I will fix this in a
separate pull request though.
On Jul 16, 2014 6:14 PM, "Ömer Sinan Ağacan" <notifications@github.com>
wrote:

> In
> src/javasources/KTool/src/org/kframework/backend/maude/krun/MaudeKRun.java:
>
> >      public MaudeKRun(Context context, Stopwatch sw) {
> >          this.context = context;
> >          this.sw = sw;
> > +
> > +        krunTempDir = new File(context.dotk, FileUtil.generateUniqueFolderName("krun"));
> > +        inFile = new File(krunTempDir, "maude_in");
> > +        outFile = new File(krunTempDir, "maude_out");
> > +        errFile = new File(krunTempDir, "maude_err");
> > +        xmlOutFile = new File(krunTempDir, "maudeoutput.xml");
> > +        processedXmlOutFile = new File(krunTempDir, "maudeoutput_simplified.xml");
> > +
> > +        if (!context.krunOptions.global.debug) {
> > +            Runtime.getRuntime().addShutdownHook(new Thread() {
> > +                public void run() {
> > +                    try {
> > +                        FileUtils.deleteDirectory(krunTempDir);
> > +                    } catch (IOException e) {
> > +                        e.printStackTrace();
>
> Is this really how we want to report a failure? (I'm not against it but we
> had problems in the past, about uncaught exceptions with unhelpful messages
> to the user)
>
> Maybe we need something like "please file a bug report this this info"
> message.
>
> Another thing that may be a problem is that we don't re-throw the
> exception. (although that may not be a problem in this case since this will
> be run on shutdown)
>
> Since this is probably not the only place where we just print stack trace
> and ignore the exception, we can probably ignore this for now and fix them
> all later.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/kframework/k/pull/674/files#r15033845>.
>