Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Bug 825766 - Catch any interrupts that have escaped all command execu…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
smarterclayton committed Jun 19, 2012
1 parent 804fb97 commit fdf7b09
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 58 deletions.
96 changes: 50 additions & 46 deletions express/bin/rhc
Expand Up @@ -41,55 +41,59 @@ def run_setup_wizard_if_needed
default_setup_wizard unless ARGV.include?('--noprompt')
end

case ARGV[0]
when "domain"
run_setup_wizard_if_needed
system("rhc-domain #{get_args} 2>&1")
retcode = $?.exitstatus
when "app"
run_setup_wizard_if_needed
system("rhc-app #{get_args} 2>&1")
retcode = $?.exitstatus
when "sshkey"
run_setup_wizard_if_needed
system("rhc-sshkey #{get_args} 2>&1")
retcode = $?.exitstatus
when "port-forward"
run_setup_wizard_if_needed
system("rhc-port-forward #{get_args} 2>&1")
retcode = $?.exitstatus
when "server"
run_setup_wizard_if_needed
begin
require 'rhc/cli'
RHC::CLI.start(ARGV)
begin
case ARGV[0]
when "domain"
run_setup_wizard_if_needed
system("rhc-domain #{get_args} 2>&1")
retcode = $?.exitstatus
when "app"
run_setup_wizard_if_needed
system("rhc-app #{get_args} 2>&1")
retcode = $?.exitstatus
when "sshkey"
run_setup_wizard_if_needed
system("rhc-sshkey #{get_args} 2>&1")
retcode = $?.exitstatus
when "port-forward"
run_setup_wizard_if_needed
system("rhc-port-forward #{get_args} 2>&1")
retcode = $?.exitstatus
when "server"
run_setup_wizard_if_needed
begin
require 'rhc/cli'
RHC::CLI.start(ARGV)
retcode = 0
rescue SystemExit => e
retcode = e.status
end
when "setup"
if ARGV.include?('--help') or ARGV.include?('-h') or ARGV.include?('help')
puts "Usage: rhc setup"
puts "Runs the setup wizard to configure your account"
exit 0
end

w = RHC::RerunWizard.new(RHC::Config.local_config_path)
success = w.run
retcode = 0
rescue SystemExit => e
retcode = e.status
end
when "setup"
if ARGV.include?('--help') or ARGV.include?('-h') or ARGV.include?('help')
puts "Usage: rhc setup"
puts "Runs the setup wizard to configure your account"
exit 0
retcode = 1 unless success
when "-h", "--help", "help", nil
p_usage 0
else
puts "Invalid rhc command: #{ARGV[0]}"
p_usage
end

w = RHC::RerunWizard.new(RHC::Config.local_config_path)
success = w.run
retcode = 0
retcode = 1 unless success
when "-h", "--help", "help", nil
p_usage 0
else
puts "Invalid rhc command: #{ARGV[0]}"
p_usage
end
if retcode == nil
retcode = 1

if retcode == nil
retcode = 1
# return codes for uncaught signals are 128 + the signal code
retcode = 128 + $?.termsig if $?.signaled? and !$?.termsig.nil?
end

# return codes for uncaught signals are 128 + the signal code
retcode = 128 + $?.termsig if $?.signaled? and !$?.termsig.nil?
exit retcode
rescue Interrupt
exit 128 + 2 #INT
end

exit retcode
24 changes: 12 additions & 12 deletions express/bin/rhc-app
Expand Up @@ -17,10 +17,10 @@ Usage: rhc app (<command> | cartridge <cartridge-action> | --help) [<args>]
Create and manage an OpenShift application.
List of commands
create Bind a registered rhcloud user to a domain in rhcloud.
create Create a new application on OpenShift
show Display information about a user
start Starts the application (includes embedded)
stop Stops the application (includes embedded)
start Starts the application (includes all cartridges)
stop Stops the application (includes all cartridges)
force-stop Stops all application processes
restart Restart the application
reload Reloads application configuration
Expand All @@ -32,17 +32,17 @@ List of commands
threaddump Trigger a thread dump for jbossas, jbosseap, and ruby applications
tail Tail the logs of an application
snapshot [save|restore] Saves/Restores an application snapshot to/from a tarball at the location specified using --filepath (default: ./$APPNAME.tar.gz)
cartridge <action> Manage an embedded cartridge
cartridge <action> Manage a cartridge runningin this application
List of cartridge actions
list List of supported embedded cartridges
add Add an embedded application
remove Remove an embedded application
stop Stop the embedded application
start Start the embedded application
restart Restart the embedded application
status Returns embedded application status
reload Reloads embedded application configuration
add Add a cartridge to this application
remove Remove a cartridge from this application
stop Stop a cartridge
start Start a cartridge
restart Restart a cartridge
status Returns cartridge status
reload Reloads cartridge configuration
List of arguments
-l|--rhlogin rhlogin Red Hat login (RHN or OpenShift login) (#{rhlogin})
Expand All @@ -63,7 +63,7 @@ List of arguments
--alias alias Specify server alias (when using add/remove-alias)
--config path Path of alternate config file
--timeout # Timeout, in seconds, for the session
--enable-jenkins [name] Indicates to create a Jenkins application (if not already available) and embed the Jenkins client into this application. The default name will be 'jenkins' if not specified. Note that --no-dns is ignored for the creation of the Jenkins application.
--enable-jenkins [name] Enables builds for your application with Jenkins. You may optionally specify the name of the Jenkins application that is created (default: 'jenkins'). Note that --no-dns is ignored for the creation of the Jenkins application.
USAGE
exit exit_code
end
Expand Down

0 comments on commit fdf7b09

Please sign in to comment.