[gnome-icon-theme] Better logic in the render script to wait for the inkscape prompt.



commit 94534bdbf85dbde0e4aa35b379fa4dd66d48d3ed
Author: Benjamin Berg <benjamin sipsolutions net>
Date:   Tue Mar 30 18:21:04 2010 +0200

    Better logic in the render script to wait for the inkscape prompt.

 render-icon-theme.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/render-icon-theme.py b/render-icon-theme.py
index 0502a92..0f6c613 100755
--- a/render-icon-theme.py
+++ b/render-icon-theme.py
@@ -14,12 +14,16 @@ def wait_for_prompt(process, command=None):
     if command is not None:
         process.stdin.write(command+'\n')
 
+    # This is kinda ugly ...
+    # Wait for just a '>', or '\n>' if some other char appearead first
     output = process.stdout.read(1)
+    if output == '>':
+        return
+
     output += process.stdout.read(1)
-    
     while output != "\n>":
-        output = output[-1:]
         output += process.stdout.read(1)
+        output = output[1:]
 
 def start_inkscape():
     process = subprocess.Popen([INKSCAPE, '--shell'], bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]