
我正在使用 RHEL7,並且剛剛安裝clang
:sudo yum install clang
。
然後我執行命令clang-format --version
,輸出如下:
me@localhost:~$ clang-format --version
LLVM (http://llvm.org/):
LLVM version 3.4.2
Optimized build.
Built May 10 2018 (10:48:27).
Default target: x86_64-redhat-linux-gnu
Host CPU: x86-64
me@localhost:~$ echo $?
1
如您所見,clang-format --version
似乎工作沒有任何錯誤,但echo $?
向我顯示了1
.
這個指令有什麼問題嗎?
我剛剛在Ubuntu系統上做了同樣的事情,沒有出現這樣的錯誤。
的輸出type -a clang-format
:
clang-format is /usr/bin/clang-format
clang-format is /bin/clang-format
的輸出file "$(command -v clang-format)"
:
/usr/bin/clang-format: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=899595580dbae12ee1ae6eb9feb8a19aa6d51f49, stripped
答案1
例如, 可以使用可在 docker 映像yum
中安裝的舊版本 clang-format 來重現此問題。已修改為返回 0
sglim2/centos7
clang-format --version
這次提交:
命令列:-version 和 -help 成功退出
目前,使用 CommandLine 函式庫的工具在使用 -version 或 -help 呼叫時會退出並出現錯誤。這是不尋常且非標準的,因此我們將修復它們以成功退出。
我不希望有人依賴當前的行為,所以這應該是一個相當安全的改變。
llvm-svn:202530