summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-11 03:49:52 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-11 03:49:52 +0000
commit2c0c4c8f6a1cb7a24f84a906a0f39e30fa75d838 (patch)
tree4d5b4fbdf1234a637f9b73a2f651192fc4fed6de
parentb1e0cc28c45119d66963525d64580a5d8cc5aaee (diff)
downloadportage-2c0c4c8f6a1cb7a24f84a906a0f39e30fa75d838.tar.gz
portage-2c0c4c8f6a1cb7a24f84a906a0f39e30fa75d838.tar.bz2
portage-2c0c4c8f6a1cb7a24f84a906a0f39e30fa75d838.zip
Use spawn() instead of system(). (trunk r10642)
svn path=/main/branches/2.1.2/; revision=10643
-rwxr-xr-xbin/dispatch-conf20
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 94e2d6cac..d2374b696 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -217,10 +217,12 @@ class dispatch:
while 1:
clear_screen()
if show_new_diff:
- os.system((self.options['diff']) % (conf['new'], mrgconf))
+ cmd = self.options['diff'] % (conf['new'], mrgconf)
+ spawn_shell(cmd)
show_new_diff = 0
else:
- os.system((self.options['diff']) % (conf['current'], newconf))
+ cmd = self.options['diff'] % (conf['current'], newconf)
+ spawn_shell(cmd)
print
print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current'])
@@ -392,6 +394,20 @@ def clear_screen():
pass
os.system("clear 2>/dev/null")
+from portage_exec import find_binary, spawn
+shell = os.environ.get("SHELL")
+if not shell or not os.access(shell, os.EX_OK):
+ shell = find_binary("sh")
+
+def spawn_shell(cmd):
+ if shell:
+ spawn([shell, "-c", cmd], env=os.environ,
+ fd_pipes = { 0 : sys.stdin.fileno(),
+ 1 : sys.stdout.fileno(),
+ 2 : sys.stderr.fileno()})
+ else:
+ os.system(cmd)
+
# run
d = dispatch ()