diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-04-26 11:26:58 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-04-26 11:28:50 +0200 |
commit | ae0c133d45fbb95a8266db505033690af46b4363 (patch) | |
tree | 99978517f02452e40fee492a372897902d54e0a9 /bin/msgimport.sh | |
parent | 23ea51e98df7f1591ff0b788809b4eba784ab27d (diff) |
Fix error handling in CLI mode, use STDERR and non-empty exit code (#1489043)
Conflicts:
program/lib/Roundcube/rcube.php
Diffstat (limited to 'bin/msgimport.sh')
-rwxr-xr-x | bin/msgimport.sh | 7 |
1 files changed, 3 insertions, 4 deletions
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); } ?> |