'Start a shell process for running commands'

def startShell(self, mnopts=None):

    if self.shell:
        error(('%s:    shell    is    already    running\n' % self.name))
        return
    opts = ('-cd' if (mnopts is None) else mnopts)
    if self.inNamespace:
        opts += 'n'
    cmd = ['mnexec', opts, 'env', ('PS1=' + chr(127)), 'bash', '--norc', '-is', ('mininet:' + self.name)]
    (master, slave) = pty.openpty()
    self.shell = self._popen(cmd, stdin=slave, stdout=slave, stderr=slave, close_fds=False)
    self.stdin = os.fdopen(master, 'rw')
    self.stdout = self.stdin
    self.pid = self.shell.pid
    self.pollOut = select.poll()
    self.pollOut.register(self.stdout)
    self.outToNode[self.stdout.fileno()] = self
    self.inToNode[self.stdin.fileno()] = self
    self.execed = False
    self.lastCmd = None
    self.lastPid = None
    self.readbuf = ''
    while True:
        data = self.read(1024)
        if (data[(-1)] == chr(127)):
            break
        self.pollOut.poll()
    self.waiting = False
    self.cmd('unset    HISTFILE;    stty    -echo;    set    +m')
