[Libguestfs] [PATCH 3/4] mllib: Allow exit code to be specified when calling 'error' function.

Richard W.M. Jones rjones at redhat.com
Mon Mar 17 12:32:24 UTC 2014


---
 mllib/common_utils.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index de3bd40..094ef10 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -187,7 +187,7 @@ let make_message_function ~quiet fs =
   in
   ksprintf p fs
 
-let error ~prog fs =
+let error ~prog ?(exit_code = 1) fs =
   let display str =
     wrap ~chan:stderr (sprintf (f_"%s: error: %s") prog str);
     prerr_newline ();
@@ -196,7 +196,7 @@ let error ~prog fs =
       (sprintf (f_"%s: If reporting bugs, run %s with debugging enabled (-v) and include the complete output.")
          prog prog);
     prerr_newline ();
-    exit 1
+    exit exit_code
   in
   ksprintf display fs
 
-- 
1.8.5.3




More information about the Libguestfs mailing list