Revision: 2559
Author: pekka.klarck
Date: Fri Feb 26 04:20:48 2010
Log: can't stand this ugly code even in helper of a test case
http://code.google.com/p/robotframework/source/detail?r=2559

Modified:
 /trunk/atest/testdata/standard_libraries/operating_system/files/prog.py

=======================================
--- /trunk/atest/testdata/standard_libraries/operating_system/files/prog.py Mon Sep 8 06:56:52 2008 +++ /trunk/atest/testdata/standard_libraries/operating_system/files/prog.py Fri Feb 26 04:20:48 2010
@@ -1,19 +1,14 @@
 import sys


-def output(stdout=None, stderr=None, count=1):
-    if stdout is not None:
+def output(rc=0, stdout='', stderr='', count=1):
+    if stdout:
         sys.stdout.write((stdout+'\n') * int(count))
-    if stderr is not None:
+    if stderr:
         sys.stderr.write((stderr+'\n') * int(count))
-
+    return int(rc)
+

 if __name__ == '__main__':
-    args = sys.argv[1:]
-    try:
-        rc = int(args[0])
-        args = args[1:]
-    except (IndexError, ValueError):
-        rc = 0
-    output(*args)
+    rc = output(*sys.argv[1:])
     sys.exit(rc)

Reply via email to