Skip to content
Browse files

(piqi getopt) Fix: added forgotten Piqi_json initialization to "piqi …

…getopt".
  • Loading branch information...
1 parent 9b32420 commit 9087531fd0516fd88d20fb9fc549f71efac30aa3 @alavrik alavrik committed Apr 9, 2011
Showing with 11 additions and 4 deletions.
  1. +1 −1 examples/test_getopt
  2. +1 −1 piqi-tools/piqi_call.ml
  3. +7 −1 piqi-tools/piqi_convert.ml
  4. +1 −0 piqi-tools/piqi_getopt_cmd.ml
  5. +1 −1 piqi-tools/piqi_server.ml
View
2 examples/test_getopt
@@ -67,7 +67,7 @@ piqi getopt --piqtype def/e -t pb -- -a | piqi convert -f pb --piqtype def/e
piqi getopt --piqtype def/e -t json -- -a | piqi convert -f json --piqtype def/e
-piqi getopt --piqtype person/person -- \
+piqi getopt --add-defaults -t json --piqtype person/person -- \
--name "J. Random Hacker" \
--id 0 \
--email "j.r.hacker@example.com" \
View
2 piqi-tools/piqi_call.ml
@@ -614,7 +614,7 @@ let run () =
Main.parse_args ()
~speclist ~usage ~min_arg_count:1 ~max_arg_count:1 ~custom_anon_fun;
- Piqi_json.init ();
+ Piqi_convert.init ();
Piqi_getopt.init ();
(* reset Piqi module lookup paths in order to prevent them from getting loaded
View
8 piqi-tools/piqi_convert.ml
@@ -291,8 +291,14 @@ let validate_options input_encoding =
)
+let init () =
+ (* XXX: this is necessary when we convert to/from json, but now calling it
+ * regardless of whether we actually need it *)
+ Piqi_json.init ()
+
+
let convert_file () =
- Piqi_json.init ();
+ init ();
let input_encoding =
if !input_encoding <> ""
then !input_encoding
View
1 piqi-tools/piqi_getopt_cmd.ml
@@ -92,6 +92,7 @@ let speclist = Main.common_speclist @
let run () =
Main.parse_args () ~speclist ~usage ~min_arg_count:0 ~max_arg_count:0;
Piqi_getopt.init ();
+ Piqi_convert.init ();
getopt_command ()
View
2 piqi-tools/piqi_server.ml
@@ -331,7 +331,7 @@ let main_loop () =
let start_server () =
- Piqi_json.init ();
+ Piqi_convert.init ();
(* exit on SIGPIPE without printing a message about uncaught exception *)
Sys.set_signal Sys.sigpipe (Sys.Signal_handle (fun _ ->
(* have to close all channels explicilty to prevent getting an uncaught

0 comments on commit 9087531

Please sign in to comment.
Something went wrong with that request. Please try again.