From f23ef1c96859f6b01a9268c8606a22ceb719cf3d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 26 Apr 2013 11:26:58 +0200 Subject: Fix error handling in CLI mode, use STDERR and non-empty exit code (#1489043) --- bin/msgimport.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'bin/msgimport.sh') diff --git a/bin/msgimport.sh b/bin/msgimport.sh index 41bcd7e53..1fcc34680 100755 --- a/bin/msgimport.sh +++ b/bin/msgimport.sh @@ -33,8 +33,7 @@ else if (!($args['host'] && $args['file'])) } else if (!is_file($args['file'])) { - print "Cannot read message file\n"; - exit; + rcube::raise_error("Cannot read message file.", false, true); } // prompt for username if not set @@ -87,7 +86,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) if ($IMAP->save_message($args['mbox'], rtrim($message))) $count++; else - die("Failed to save message to {$args['mbox']}\n"); + rcube::raise_error("Failed to save message to {$args['mbox']}", false, true); $message = ''; } continue; @@ -108,7 +107,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) } else { - print "IMAP login failed.\n"; + rcube::raise_error("IMAP login failed.", false, true); } ?> -- cgit v1.2.3