From 9edfb27bd249800d71c3fcbf58ab3d75e5831b78 Mon Sep 17 00:00:00 2001 From: Adam Sanderson Date: Wed, 29 Dec 2010 09:01:18 -0700 Subject: [PATCH] Making Qwandry return better exit codes, if the editor command fails, pass the exit code through. Also use 4 instead of 404 for no matching package since exit codes should not exceed 127. --- bin/qw | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/qw b/bin/qw index cb80282..33e90ef 100755 --- a/bin/qw +++ b/bin/qw @@ -57,7 +57,7 @@ end opts.parse! ARGV if ARGV.length == 0 puts opts - exit(1) + exit 1 end # Configure default values @@ -71,7 +71,7 @@ package = nil case packages.length when 0 puts "No packages matched '#{name}'" - exit 404 # Package not found -- hehe, super lame. + exit 4 # Exit code 4 for No Package when 1 package = packages.first else @@ -85,7 +85,11 @@ else end if package - if not @qwandry.launch(package) - exit 1 + if @qwandry.launch(package) + # Exit code 0 for success + exit 0 + else + # Exit with the status returned by the process used to open the package + exit $?.exitstatus end end