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.

This commit is contained in:
Adam Sanderson 2010-12-29 09:01:18 -07:00
parent 77d89621de
commit 9edfb27bd2
1 changed files with 8 additions and 4 deletions

12
bin/qw
View File

@ -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