summaryrefslogtreecommitdiff
path: root/portato/plugins/resume_loop.py
blob: 45c735a015b0d7ab13234db08838a90730681c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
#
# File: portato/plugins/resume_loop.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
# Copyright (C) 2007 René 'Necoro' Neumann
# This is free software.  You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>

import pty
from subprocess import call, STDOUT
from portato.backend import system
from portato.helper import debug, warning

console = None
command = "until emerge --resume --skipfirst; do : ; done"

def set_console (*args, **kwargs):
	global console
	console = kwargs["console"]

def resume_loop (retcode, *args, **kwargs):
	if retcode is None:
		warning("Resume-loop called while process is still running!")
	elif retcode == 0:
		# everything ok - ignore
		#pass
		debug("Everything is ok.")
	else:
		if console is None:
			debug("No console for the resume loop...")
		else:
			# open tty
			(master, slave) = pty.openpty()
			console.set_pty(master)
			call(command, stdout = slave, stderr = STDOUT, shell = True, env = system.get_environment())
etions'>-0/+3 2011-11-21Added support for jedit.René Neumann2-4/+11 2011-11-16Make 'hg k' work similar to 'git k'René 'Necoro' Neumann1-0/+3 2011-10-14'tabgroup' -> 'tabgroups'René 'Necoro' Neumann1-1/+1 2011-10-14Switch from openoffice alias to libreoffice (ooffice -> soffice)René 'Necoro' Neumann1-2/+2 2011-10-14Make the quotes in ProofGeneral to be nearly invisibleRené Neumann1-1/+1 2011-08-23Disable hightlighting of the domain in the FF urlbarRené Neumann1-0/+3 2011-08-12Enhance IE scriptRené Neumann1-6/+7 2011-08-11BlaRené 'Necoro' Neumann1-0/+2 2011-08-11Local fontsRené 'Necoro' Neumann1-13/+22 2011-08-11Better inconsolata thingsRené Neumann4-4/+13 2011-08-10Moved some functions to their own filesRené Neumann3-124/+120 2011-08-10More advanced IE scriptRené Neumann2-1/+74 2011-08-10Inconsolata also in emacsRené Neumann1-1/+1 2011-08-10Better vim fontsRené 'Necoro' Neumann1-1/+1 2011-08-09ooffice aliasRené Neumann1-0/+2 2011-08-09Update the needed hg-extensions.René Neumann1-1/+2 2011-06-08gtkrc stuff for Qt-Gtk-StyleRené 'Necoro' Neumann2-0/+8 2011-06-08Updated fonts.conf to work better on lcdsRené 'Necoro' Neumann1-17/+6