Hi Josh,

 

I already looked into the workaround discussed in the bug report, but since I am create a “shell” like window using a JTextPane it is not able to generate the SIGINT via Ctrl-C (since it is captured by Swing for “copy” operations on Windows).

 

I could capture the key events and try to generate the SIGINT myself – but os.kill() is not implemented, on Windows at least. I also thought about setting a SIGBREAK but that signal is not supported by Jython.

 

I also tried just assigning an action to my keymap on the JTextPane, so I could make a call such as from Java;

            Interpreter.exec(“raise KeyboardInterrupt()”)

 

But doing so does not cause my scripts to stop at all.

 

joey

 


From: Josh Juneau [mailto:juneau001@gmail.com]
Sent: Tuesday, August 04, 2009 9:33 PM
To: Jython Users
Subject: [Jython-users] Fwd: How to interrupt running function?

 

It looks like this is an open bug according to the tracker:  http://bugs.jython.org/issue1313

 

If you take a look at the commentary, it looks as though there is a possible workaround for the time being.

 

Hope this helps.


Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
Twitter ID:  javajuneau

On Fri, Jul 31, 2009 at 6:57 PM, Joey Jarosz <joey@cadence.com> wrote:

I am creating an interactive shell for Jython within an application. How can I force a long running function/method to be interrupted and return control back to the shell?  In PythonC, the user can type Ctrl-C to make this happen. So I tried several attempts with no luck. I tried to call InteractiveInterpreter.interrupt() but that does not seem to do anything to interrupt a running function. I also tried interjecting a “raise KeyboardInterrupt” but that also had no affect.

 

What am I missing?

 

joey

 

--------------------------------------------
Joey Jarosz

Senior Architect

Chip Planning Solutions

Cadence Design Systems, Inc.
(408) 914-6269


Need some IP? Check out www.chipestimate.com 

 

 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users