From 9e208c7bf99943117c938cdeebd20c32f1d25ec7 Mon Sep 17 00:00:00 2001 From: Jesus Roncero Date: Mon, 9 Sep 2013 17:04:25 +0100 Subject: [PATCH] Add exit codes when failing. On mogdelete, mogfetch and moglistkeys when failing, it writes to STDERR with there's an error, but it exits with 0. Change it to exist with an error. Signed-off-by: Eric Wong --- mogdelete | 2 +- mogfetch | 1 + moglistkeys | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mogdelete b/mogdelete index 8bdd898..7fa478c 100755 --- a/mogdelete +++ b/mogdelete @@ -54,5 +54,5 @@ my $mogc = $util->client; $mogc->delete($c->{key}); if ($mogc->errcode) { - print STDERR "Error deleting file: ", $mogc->errstr, "\n"; + die "Error deleting file: ", $mogc->errstr, "\n"; } diff --git a/mogfetch b/mogfetch index e3cb006..eea5cee 100755 --- a/mogfetch +++ b/mogfetch @@ -102,4 +102,5 @@ if (@resses) { print STDERR "Got errors while trying to fetch:\n"; print STDERR $res->status_line, "\n"; } + exit 1; } diff --git a/moglistkeys b/moglistkeys index 50a2300..40f1fdb 100755 --- a/moglistkeys +++ b/moglistkeys @@ -67,5 +67,5 @@ $mogc->foreach_key(prefix => $c->{key_prefix}, sub { }); if ($mogc->errcode) { - print STDERR "Error listing files: ", $mogc->errstr, "\n"; + die "Error listing files: ", $mogc->errstr, "\n"; }