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:
parent
77d89621de
commit
9edfb27bd2
12
bin/qw
12
bin/qw
@ -57,7 +57,7 @@ end
|
|||||||
opts.parse! ARGV
|
opts.parse! ARGV
|
||||||
if ARGV.length == 0
|
if ARGV.length == 0
|
||||||
puts opts
|
puts opts
|
||||||
exit(1)
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Configure default values
|
# Configure default values
|
||||||
@ -71,7 +71,7 @@ package = nil
|
|||||||
case packages.length
|
case packages.length
|
||||||
when 0
|
when 0
|
||||||
puts "No packages matched '#{name}'"
|
puts "No packages matched '#{name}'"
|
||||||
exit 404 # Package not found -- hehe, super lame.
|
exit 4 # Exit code 4 for No Package
|
||||||
when 1
|
when 1
|
||||||
package = packages.first
|
package = packages.first
|
||||||
else
|
else
|
||||||
@ -85,7 +85,11 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
if package
|
if package
|
||||||
if not @qwandry.launch(package)
|
if @qwandry.launch(package)
|
||||||
exit 1
|
# 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
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user