Thanks Eric, I am using GNU Radio git depository installed a month ago. tried on Cygwin 1.7.5+WinXP and OSX 10.6.3+Macbook, both behaved the same. I'll try ubuntu tomorrow when I have access to another PC. Ctrl+C exits the program but not caught by except.
On 17/06/2010, at 5:45 AM, Eric Blossom wrote: > What version of GNU Radio? > What OS, distribution, version? > (We fixed bugs in this area about a year ago...) > > > On Thu, Jun 17, 2010 at 12:29:10AM +1000, Kyle Zhou wrote: >> >> Basically, I want to catch Ctrl+C after top_block.run() >> For example >> >> try: >> >> my_top_block().run() >> >> except KeyboardInterrupt: >> >> print "Ctrl+C has been pressed. Exiting." >> >> >> However, when Ctrl+C is pressed, the program exits straight away without >> executing the print function. >> >> It seems that KeyboardInterrupt is not propagated to the main thread? >> >> >> What am I doing wrong? >> >> >> By the way, if I caught some exception in work(), what is the best way to >> exit the program? top_block.stop() or raise SystemExit, 1? > > Just return -1 from work. The graph will stop. > > Eric _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio