]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/lyxpaperview.py
DocBook: make all make* functions have the same argument order.
[lyx.git] / lib / scripts / lyxpaperview.py
index e370c95fa7b7ea7e5f61d5617156488c7c1bbca6..09256da7cbdedcb4bec0b5ce7bbbb447d9bee18a 100755 (executable)
@@ -6,6 +6,7 @@
 # Licence details can be found in the file COPYING.
 
 # author Jürgen Spitzmüller
+# This draws on a bash script and conceptual idea by Pavel Sanda
 # Full author contact details are available in file CREDITS
 
 # This script searches the home directory for a PDF or PS
@@ -83,7 +84,7 @@ def find(args, path):
                    # have this already
                    continue
                px = subprocess.Popen(['grep', '-i', arg], stdin=px.stdout, stdout=subprocess.PIPE)
-            p4 = subprocess.Popen(['head', '-n 2'], stdin=px.stdout, stdout=subprocess.PIPE)
+            p4 = subprocess.Popen(['head', '-n 1'], stdin=px.stdout, stdout=subprocess.PIPE)
             p1.stdout.close()
             output = p4.communicate()
             return output[0].decode("utf8")[:-1]# strip trailing '\n'
@@ -121,7 +122,7 @@ def main(argv):
     result = find(args, path = os.environ["HOME"])
     if result == "":
         message("no document found!")
-        return 0
+        exit(2)
     else:
         message("found document %s" % result)
 
@@ -139,7 +140,7 @@ def main(argv):
     
     subprocess.call([viewer, result])
     
-    return 0
+    exit(0)
 
 if __name__ == "__main__":
     main(sys.argv)