]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: report error string to stderr, not stdout
authorSage Weil <sage@inktank.com>
Wed, 19 Dec 2012 03:21:24 +0000 (19:21 -0800)
committerSage Weil <sage@inktank.com>
Wed, 19 Dec 2012 03:21:24 +0000 (19:21 -0800)
If we return an error, send the message to stderr.  This makes things
more easily scriptable because error messages won't take the place of
expected output.

Signed-off-by: Sage Weil <sage@inktank.com>
src/tools/common.cc

index 9679f08834eded68b2f2ce58eb485a9f2c8e1af8..9a3763a34aeaf8b2aaa6c70d5a25c8f890da2e39 100644 (file)
@@ -294,8 +294,12 @@ int do_command(CephToolCtx *ctx,
           << reply_from.name << " -> '"
           << reply_rs << "' (" << reply_rc << ")"
           << std::endl;
-  else
-    cout << reply_rs << std::endl;
+  else {
+    if (reply_rc >= 0)
+      cout << reply_rs << std::endl;
+    else
+      cerr << reply_rs << std::endl;
+  }
 
   return reply_rc;
 }