From: Ali Alnubani Date: Tue, 8 Jan 2019 12:38:45 +0000 (+0000) Subject: Fix return code when getting patch information fails X-Git-Tag: v2.2.0-rc1~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc7810e241e27c1c0476145e665da5d156253e1a;p=thirdparty%2Fpatchwork.git Fix return code when getting patch information fails The `info` command always exits with success, even if the patch didn't exist. Modified to exit with a non-zero exit status and print an error message in that case. Signed-off-by: Ali Alnubani Reviewed-by: Stephen Finucane --- diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient index 2cff3a35..43c7a373 100755 --- a/patchwork/bin/pwclient +++ b/patchwork/bin/pwclient @@ -275,6 +275,12 @@ def action_states(rpc): def action_info(rpc, patch_id): patch = rpc.patch_get(patch_id) + + if patch == {}: + sys.stderr.write("Error getting information on patch ID %d\n" % + patch_id) + sys.exit(1) + s = "Information for patch id %d" % (patch_id) print(s) print('-' * len(s))