def get_sessionname(session=None): if session: session_arg = '-S "%s"' % session else: session_arg = "" p = os.popen(SCREEN + " %s -X sessionname" % session_arg).close() s = timeout_command(SCREEN + " %s -Q @lastmsg" % session_arg, 3)[0] return s.split("'", 1)[1].rsplit("'", 1)[0]
def get_sessionname(session=None): if session: session_arg = '-S \"%s\"' % session else: session_arg = '' p = os.popen(SCREEN + ' %s -X sessionname' % session_arg).close() s = timeout_command(SCREEN + ' %s -Q @lastmsg' % session_arg, 3)[0] return s.split('\'', 1)[1].rsplit('\'', 1)[0]
def get_sessionname(session=None): if session: session_arg='-S '+session else: session_arg='' p=os.popen('screen %s -X sessionname'%session_arg).close() s=timeout_command('screen %s -Q @lastmsg'%session_arg,3)[0] return s.split('\'',1)[1].rsplit('\'',1)[0]
def query_at(self,command,win="-1"): if win=="-1": win="" else: win="-p %s"%win try: cmd='%s %s -Q @%s'% (self.sc,win,command) l=util.timeout_command(cmd,self.timeout)[0] if l.startswith('C'): #no such window return -1 else: return l except: return None
def query_at(self, command, win="-1"): if win == "-1": win = "" else: win = r'''-p "%s"''' % win try: cmd = r"""%s %s -Q @%s""" % (self.sc, win, command) l = util.timeout_command(cmd, self.timeout)[0] # print ('%s = query_at(%s, %s): %s'%(l, command, win , cmd)) if l.startswith('C'): #no such window return -1 else: return l except: return None
def query_at(self, command, win="-1"): if win == "-1": win = "" else: win = r'''-p "%s"''' % win try: cmd = r"""%s %s -Q @%s""" % (self.sc, win, command) l = util.timeout_command(cmd, self.timeout)[0] # print ('%s = query_at(%s, %s): %s'%(l, command, win , cmd)) if l.startswith("C"): # no such window return -1 else: return l except: return None
elif o in ("-n", "--no-group-wrap"): bNoGroupWrap = True elif o in ("-l", "--log"): log = a elif o == "--pack": pack = a elif o == "--unpack": unpack = a elif o in ("-s", "--savefile"): savefile = a elif o in "-S": if a == '.': subprogram = os.path.join(os.path.dirname((sys.argv)[0]), 'sessionname.py') current_session = util.timeout_command("%s %s \"%s\"" % (os.getenv('PYTHONBIN'), subprogram, current_session), 4)[0].strip() else: current_session = a elif o in "--session": current_session = a elif o in ("-V", "--no-vim"): bVim = False elif o in ("-W", "--no-shellvars"): bShellvars = False elif o in ("-H", "--no-scroll"): scroll.append(a) elif o in ("-x", "--exact"): bExact = True elif o in ("-X", "--exact-kill"): bExact = True
def lastmsg(self): return util.timeout_command('%s -Q @lastmsg' % self.sc, self.timeout)[0]
def lastmsg(self): return util.timeout_command("%s -Q @lastmsg" % self.sc, self.timeout)[0]
def lastmsg(self): return util.timeout_command('%s -Q @lastmsg' % (self.sc),self.timeout)[0]