Logo Search packages:      
Sourcecode: ipython version File versions  Download package

def IPython::gui::wx::ipshell_nonblocking::NonBlockingIPShell::_shell (   self,
  ip,
  cmd 
) [private]

Replacement method to allow shell commands without them blocking.

@param ip: Ipython instance, same as self._IP
@type cmd: Ipython instance
@param cmd: Shell command to execute.
@type cmd: string

Definition at line 508 of file ipshell_nonblocking.py.

00508                              :
        '''
        Replacement method to allow shell commands without them blocking.

        @param ip: Ipython instance, same as self._IP
        @type cmd: Ipython instance
        @param cmd: Shell command to execute.
        @type cmd: string
        '''
        stdin, stdout = os.popen4(cmd)
        result = stdout.read().decode('cp437').\
                                            encode(locale.getpreferredencoding())
        #we use print command because the shell command is called
        #inside IPython instance and thus is redirected to thread cout
        #"\x01\x1b[1;36m\x02" <-- add colour to the text...
        print "\x01\x1b[1;36m\x02"+result
        stdout.close()
        stdin.close()
        stdin.close()


Generated by  Doxygen 1.6.0   Back to index