def parun(commands, minheight=DEFAULT_MINHEIGHT, daemon=False, session_name=None): if (termcap_get_lines() - len(commands)) / len(commands) >= minheight: split = True else: split = False stdin = None if not os.isatty(sys.stdin.fileno()): stdin = TempFile() stdin.write(sys.stdin.read()) stdin.close() # screen wants stdin to be connected to a tty os.dup2(sys.stderr.fileno(), sys.stdin.fileno()) screens = fmt_screens(commands, stdin) if split: screenrc = "split\nfocus\n".join([ screen + "\n" for screen in screens ]) else: screenrc = "\n".join(screens) + "\n" + "windowlist -b" + "\n" screenrc_tmp = TempFile() screenrc_tmp.write(screenrc) screenrc_tmp.close() args = ["-c", screenrc_tmp.path] if daemon: args += [ "-dm" ] if session_name: args += [ "-S", session_name ] executil.system("screen", *args) if daemon: time.sleep(1)
def _apply_overlay(src, dst, olist): tmp = TempFile("fsdelta-olist-") for fpath in olist: print >> tmp, fpath.lstrip('/') tmp.close() utils.apply_overlay(src, dst, tmp.path)
def _apply_overlay(src, dst, olist): tmp = TempFile("fsdelta-olist-") for fpath in olist: print >> tmp, fpath.lstrip('/') tmp.close() apply_overlay(src, dst, tmp.path)