summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-20 12:58:31 +0200
committerhut <hut@lavabit.com>2010-04-20 18:58:15 +0200
commitb1ed3da5ebd065e2077370bf7fc24112906943e3 (patch)
tree1cccdcbc47a96217164b341446d7f73c5683892e
parent42cda6f82a8019cf477527ff4b44b22948ae65cf (diff)
downloadranger-b1ed3da5ebd065e2077370bf7fc24112906943e3.tar.gz
core.actions.paste(): use select for parallel listening for stderr
-rw-r--r--ranger/core/actions.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index ef18a553..fa77a497 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -15,6 +15,7 @@
 
 import os
 import re
+import select
 import shutil
 import time
 from os.path import join, isdir
@@ -593,13 +594,17 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 			else:
 				descr = "copying files from: " + one_file.dirname
 			def generate():
+				null = open(os.devnull, 'w')
 				process = Popen(['cp', '--backup=existing', '--archive',
 					'-t', self.env.cwd.path] + \
 							[f.path for f in self.env.copy],
-					stdout=PIPE, stderr=PIPE)
+					stdout=null, stderr=PIPE)
 				while process.poll() is None:
+					rd, _, __ = select.select(
+							[process.stderr], [], [], 0.05)
+					if rd:
+						self.notify(process.stderr.readline(), bad=True)
 					yield
-					time.sleep(0.05)
 				cwd = self.env.get_directory(original_path)
 				cwd.load_content()