Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用InteractiveConsole处理Ctrl-Z?_Python_Python 2.7_Python 2.6 - Fatal编程技术网

Python 如何使用InteractiveConsole处理Ctrl-Z?

Python 如何使用InteractiveConsole处理Ctrl-Z?,python,python-2.7,python-2.6,Python,Python 2.7,Python 2.6,我有一个简单的片段: import code class d(code.InteractiveConsole): def runsource(self, source, filename): print 'mongoose rocking ', source, ' ', filename return code.InteractiveConsole.runsource(self, source, filename) d1 = d() d1.interact() 这与预期完

我有一个简单的片段:

import code
class d(code.InteractiveConsole):
  def runsource(self, source, filename):
    print 'mongoose rocking ', source, ' ', filename
    return code.InteractiveConsole.runsource(self, source, filename)

d1 = d()
d1.interact()

这与预期完全一样,只是有一点不同:在python提示符中输入Ctrl+Z以暂停进程。当我在shell提示符下按fg时,这个过程就消失了。我怀疑信号没有被处理,但我不明白为什么——当我运行Python时,否则Ctrl+Z就可以正常工作。我错过了什么

无法在FreeBSD 10.1上使用python2.7.9进行复制:shell提示符中的Ctrl-Z+fg返回相同的提示级别(使用您的代码,我仍然看到mongoose在摇摆)我在mac osx10.7.4中使用python2.7,您所说的“进程刚刚消失”到底是什么意思?