def upload_zmodem(self, filename):
        sockfd = self.sock.fileno()
        pread, pwrite = os.pipe()
        pid = os.fork()
        if pid == 0: # child
            os.dup2(sockfd, 0)
            os.dup2(sockfd, 1)
            os.dup2(pwrite, 2)
            os.close(pread)
            os.close(pwrite)
            for fd in xrange(3,64):
                try:
                    os.close(fd)
                except:
                    pass
            os.write(0, "rz -e -q -s +30\r") # needed with -e flag on sz
            os.execlp("sz", "sz", "-e", "-q", "-y", "-L", "128", filename)
            os._exit(1) # not normally reached
        # parent
        os.close(pwrite)
        while True:
            wpid, es = os.waitpid(pid, 0)
            if wpid == pid:
                break
        errout = os.read(pread, 4096)
        es = ExitStatus("sz {}".format(filename), es)
        es.output = errout
        return es
Call external ZMODEM program to upload a file.
dataset/ETHPy150Open kdart/pycopia/core/pycopia/inet/telnet.py/Telnet.upload_zmodem