summaryrefslogtreecommitdiff
path: root/bin/msgimport.sh
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-04-26 11:26:58 +0200
committerAleksander Machniak <alec@alec.pl>2013-04-26 11:26:58 +0200
commitf23ef1c96859f6b01a9268c8606a22ceb719cf3d (patch)
tree7c4ea8f0c79caba006903cffdbeddb31c9154f38 /bin/msgimport.sh
parentddfdd8938d78b40842a984d310e3c35af30ece0a (diff)
Fix error handling in CLI mode, use STDERR and non-empty exit code (#1489043)
Diffstat (limited to 'bin/msgimport.sh')
-rwxr-xr-xbin/msgimport.sh7
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);
}
?>