@deferredAsThread
    def shell_action(server, *cmd):
        readfd,writefd = os.pipe()
        pid = os.fork()
        if pid == 0:
            devnull = open('/dev/null','r')
            os.dup2(devnull.fileno(),0)
            os.dup2(writefd,1)
            os.dup2(writefd,2)
            os.execvp('/bin/sh',['/bin/sh','-c'] + list(cmd))
            os._exit(255)
        else:
            os.close(writefd)
            fh = os.fdopen(readfd)
            output = fh.read()
            status = os.waitpid(pid,0)
        return (status[1] >> 8,output)
Usage: shell <cmd>
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/models/server.py/DroneServer.shell_action