diff options
author | hut <hut@lavabit.com> | 2010-04-20 12:58:31 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-20 18:58:15 +0200 |
commit | b1ed3da5ebd065e2077370bf7fc24112906943e3 (patch) | |
tree | 1cccdcbc47a96217164b341446d7f73c5683892e | |
parent | 42cda6f82a8019cf477527ff4b44b22948ae65cf (diff) | |
download | ranger-b1ed3da5ebd065e2077370bf7fc24112906943e3.tar.gz |
core.actions.paste(): use select for parallel listening for stderr
-rw-r--r-- | ranger/core/actions.py | 9 |
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() |