# 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
# 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'
result = find(args, path = os.environ["HOME"])
if result == "":
message("no document found!")
- return 0
+ exit(2)
else:
message("found document %s" % result)
subprocess.call([viewer, result])
- return 0
+ exit(0)
if __name__ == "__main__":
main(sys.argv)