Actually, it occurs to me that there's a simpler approach, which might
sometimes be wiser - arrange for standard input to be something other
than the keyboard. For example, under unix:

:|jconsole -js 'echo 1+1'

You'll get a prompt before the exit, but you can avoid that with an
explicit exit statement:

:|jconsole -js 'echo i.3 3' 'exit 0'

Under windows this can be a bit uglier:

echo ] >blah.txt
jconsole -js 'echo i.3 3' < blah.txt

So... why is this a good idea?

Well, a problem with using something like "9!:29]1[9!:27 'exit 1'" is
that this suppresses the display of any error messages. By instead
specifying an empty (or nearly empty) file as standard input, you get
to see the error message and stack trace.

And you should not care if the display looks a bit messy under error
conditions - your real concern should be in alleviating the error.

(But if you want an error exit code, you might still want to use some
variation on the other approach...)

Thanks,

-- 
Raul

On Mon, Mar 2, 2015 at 4:40 AM, Chernin, Nadav <chern...@corning.com> wrote:
> Hi, all
> I use J as script language from another language through jconsole
> Like this:
> jconsole -js a=.23 b=.3 "echo a*b" "exit''"
> My problem is when script is wrong console application don't exit
> Like in this example
>
> jconsole -js a=.23 b=.3 "echo a*b*c" "exit''"
> What can I do?
> Thanks
>
> Nadav Chernin
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to