我正在使用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
例如,可以使用可yum
在sglim2/centos7
docker映像中安装的旧版本的clang格式来重现此问题。clang-format --version
已修改为在此提交中返回0 :
命令行:成功退出-version和-help
当使用-version或-help调用时,使用CommandLine库的工具当前退出并出现错误。这是不常见且非标准的,因此我们将修复它们以成功退出。
我不希望任何人依赖当前的行为,因此这应该是一个相当安全的更改。
llvm-svn:202530
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句