Ticket #713: 6404.patch

File 6404.patch, 1.1 KB (added by malb, 14 years ago)
  • sage/interfaces/singular.py

    # HG changeset patch
    # User Martin Albrecht <malb@informatik.uni-bremen.de>
    # Date 1190312844 -3600
    # Node ID d7ff07b465f95da139a17b2907f2692c365170c1
    # Parent  796e7feb772023fa971defe413149020f1981fc1
    fix interrupting of Singular subprocess
    
    diff -r 796e7feb7720 -r d7ff07b465f9 sage/interfaces/singular.py
    a b class Singular(Expect): 
    740740        else:
    741741            SingularFunction(self,"option")("\""+str(cmd)+"\"")
    742742
     743    def _keyboard_interrupt(self):
     744        print "Interrupting %s..."%self
     745        try:
     746            self._expect.sendline(chr(4))
     747        except pexpect.ExceptionPexpect:
     748            print "WARNING: -- unable to kill %s. You may have to do so manually."%self
     749            pass
     750        self._start()
     751        raise KeyboardInterrupt, "Restarting %s (WARNING: all variables defined in previous session are now invalid)"%self
     752
    743753class SingularElement(ExpectElement):
    744754    def __init__(self, parent, type, value, is_name=False):
    745755        RingElement.__init__(self, parent)