summaryrefslogtreecommitdiff
path: root/plugins/externaltools/tools/capture.py
diff options
context:
space:
mode:
authorPatrick Monnerat <[email protected]>2019-05-10 16:26:39 +0200
committerraveit65 <[email protected]>2019-05-21 09:36:44 +0200
commite88a2ea8adb4a57c9cf5c44fe30c210c8608361b (patch)
treea70133a625b31710d79dc5fdd77589b69e24c003 /plugins/externaltools/tools/capture.py
parent676669e4e87130f639e118671d754a5e538f191c (diff)
downloadpluma-e88a2ea8adb4a57c9cf5c44fe30c210c8608361b.tar.bz2
pluma-e88a2ea8adb4a57c9cf5c44fe30c210c8608361b.tar.xz
Reindent all Python sources to ts=4. Strip trailing spaces.
Diffstat (limited to 'plugins/externaltools/tools/capture.py')
-rwxr-xr-xplugins/externaltools/tools/capture.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/externaltools/tools/capture.py b/plugins/externaltools/tools/capture.py
index 487c8dbb..73ce2702 100755
--- a/plugins/externaltools/tools/capture.py
+++ b/plugins/externaltools/tools/capture.py
@@ -29,7 +29,7 @@ class Capture(GObject.Object):
CAPTURE_STDERR = 0x02
CAPTURE_BOTH = 0x03
CAPTURE_NEEDS_SHELL = 0x04
-
+
WRITE_BUFFER_SIZE = 0x4000
__gsignals__ = {
@@ -73,7 +73,7 @@ class Capture(GObject.Object):
'shell': self.flags & self.CAPTURE_NEEDS_SHELL,
'env' : self.env
}
-
+
if self.input_text is not None:
popen_args['stdin'] = subprocess.PIPE
if self.flags & self.CAPTURE_STDOUT:
@@ -84,17 +84,17 @@ class Capture(GObject.Object):
self.tried_killing = False
self.idle_write_id = 0
self.read_buffer = ''
-
+
try:
self.pipe = subprocess.Popen(self.command, **popen_args)
except OSError, e:
self.pipe = None
self.emit('stderr-line', _('Could not execute command: %s') % (e, ))
return
-
+
# Signal
self.emit('begin-execute')
-
+
if self.flags & self.CAPTURE_STDOUT:
# Set non blocking
flags = fcntl.fcntl(self.pipe.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK
@@ -132,13 +132,13 @@ class Capture(GObject.Object):
try:
l = len(self.write_buffer)
m = min(l, self.WRITE_BUFFER_SIZE)
-
+
self.pipe.stdin.write(self.write_buffer[:m])
-
+
if m == l:
self.write_buffer = ''
self.pipe.stdin.close()
-
+
self.idle_write_id = 0
return False
@@ -165,7 +165,7 @@ class Capture(GObject.Object):
self.read_buffer += line
lines = self.read_buffer.splitlines(True)
-
+
if not lines[-1].endswith("\n"):
self.read_buffer = lines[-1]
lines = lines[0:-1]