lib/flare_up/boot.rb in flare-up-0.6 vs lib/flare_up/boot.rb in flare-up-0.7

- old
+ new

@@ -1,16 +1,30 @@ module FlareUp class Boot - # TODO: This control flow is untested + # TODO: This control flow is untested and too procedural def self.boot(options) conn = create_connection(options) copy = create_copy_command(options) begin + trap('SIGINT') do + Emitter.warn('CTRL-C received; cancelling COPY command...') + error_message = conn.cancel_current_command + if error_message + Emitter.error("Error cancelling COPY: #{error_message}") + else + Emitter.success('COPY command cancelled.') + end + CLI.bailout(1) + end + Emitter.info("Executing command: #{copy.get_command}") handle_load_errors(copy.execute(conn)) + rescue ConnectionError => e + Emitter.error(e.message) + CLI.bailout(1) rescue CopyCommandError => e Emitter.error(e.message) CLI.bailout(1) end \ No newline at end of file