[ 
https://issues.apache.org/jira/browse/GERONIMO-3978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885176#action_12885176
 ] 

ant elder commented on GERONIMO-3978:
-------------------------------------

Coincidentally, I've a similar problem with Tuscany using JLine and ctrl-c not 
working so googling for solutions i found this JIRA along with many others 
trying to fix it with no answers. So i did some debugging of the JLine code and 
I think the problem is in the windowsbindings.properties file shipped inside 
jline which maps ctrl-c to INSERT with a comment saying "(frankly, I wasn't 
sure where to bind this)". That does not seem a great choice as that is what 
disables the ctrl-c interupt. It is possible to pass in your own bindings 
properties file but to do that has some problems of its own so the simplest 
solution seemed to be the following code which resets the ctrl-c binding:

       ConsoleReader reader = ...

        try {
            Field f = ConsoleReader.class.getDeclaredField("keybindings");
            f.setAccessible(true);
            short[] keybindings = (short[])f.get(reader);
            if (keybindings[3] == -48) keybindings[3] = 3;
        } catch (Exception e) {
            e.printStackTrace(); // shouldnt happen
        }

You can then add an ActionListener to do what you want when ctrl-c is pressed, 
eg:

        reader.addTriggeredAction((char)3, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });





> Unable to CTRL-C "start-server" process on Windows
> --------------------------------------------------
>
>                 Key: GERONIMO-3978
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3978
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>         Environment: Win XP, G Tomcat 2.1
>            Reporter: Vamsavardhana Reddy
>            Assignee: Jason Dillon
>
> On Windows XP, if I start a Geronimo Tomcat 2.1 server using bin\start-server 
> from a command prompt, I am noticing that the server can not be shutdown 
> using Control+C.  So, I am using Admin Console to shutdown the server.  But 
> it does not return to command prompt unless I kill the java process from 
> Windows Task Manager.
> Jarek says, "As a workaround, you can start gshell with -T false option and 
> then
> control-c worked fine while running the server in foreground."
> See http://www.mail-archive.com/[email protected]/msg57308.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to