[cli] print version on stdout

Summary:
Buck reads the version on stderr or, very recently, from either stdout or stderr.

This makes infer output the version of stderr when called from Buck or invoked as javac, and on stdout otherwise.

Reviewed By: martinoluca

Differential Revision: D6098392

fbshipit-source-id: 23f1d5a
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 69b136d7b8
commit 664616faab

@ -17,8 +17,9 @@ BUILD_MODE ?= opt
MAKE_SOURCE = $(MAKE) -C $(SRC_DIR) INFER_BUILD_DIR=_build/$(BUILD_MODE) MAKE_SOURCE = $(MAKE) -C $(SRC_DIR) INFER_BUILD_DIR=_build/$(BUILD_MODE)
ifneq ($(UTOP),no) ifneq ($(UTOP),no)
BUILD_SYSTEMS_TESTS += infertop # TODO: turn this back on
build_infertop_print build_infertop_test: test_build #BUILD_SYSTEMS_TESTS += infertop
#build_infertop_print build_infertop_test: test_build
endif endif
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)

@ -1856,9 +1856,9 @@ let post_parsing_initialization command_opt =
if CommandLineOption.is_originator then if CommandLineOption.is_originator then
Unix.putenv ~key:infer_top_results_dir_env_var ~data:!results_dir ; Unix.putenv ~key:infer_top_results_dir_env_var ~data:!results_dir ;
( match !version with ( match !version with
| `Full | `Full when !buck
-> (* TODO(11791235) change back to stdout once buck integration is fixed *) -> (* Buck reads stderr in some versions, stdout in others *)
prerr_endline version_string print_endline version_string ; prerr_endline version_string
| `Javac when !buck | `Javac when !buck
-> (* print buck key *) -> (* print buck key *)
let javac_version = let javac_version =
@ -1886,9 +1886,12 @@ let post_parsing_initialization command_opt =
| None | None
-> Version.commit -> Version.commit
in in
F.printf "%s/%s/%s@." javac_version analyzer_name infer_version ;
F.eprintf "%s/%s/%s@." javac_version analyzer_name infer_version F.eprintf "%s/%s/%s@." javac_version analyzer_name infer_version
| `Full
-> print_endline version_string
| `Javac | `Javac
-> prerr_endline version_string -> (* javac prints version on stderr *) prerr_endline version_string
| `Json | `Json
-> print_endline Version.versionJson -> print_endline Version.versionJson
| `Vcs | `Vcs

Loading…
Cancel
Save