我使用 Silk4J,在我的构建中,我必须启动代理。我使用的命令是:
<exec spawn="true" executable="${env.OPEN_AGENT_HOME}/agent/openAgent.exe" />
它给了我这个错误
The ' characters around the executable and arguments are not part of the command.
我需要改变它吗?
该消息并不表示错误。
当给 Ant 提供-v
, -verbose
, -d
, or选项时,任务会输出它正在执行的命令以及消息:-debug
<exec>
[exec] Current OS is Windows 7
[exec] Executing 'cmd' with arguments:
[exec] '/c'
[exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] 10/23/2013 02:36 AM
分解上面的例子......
[exec] Executing 'cmd' with arguments:
^ ^
[exec] '/c'
^ ^
[exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta'
^ ^
在这种情况下,每个上面的单引号 ( '
)^
不是命令的一部分。Ant 将可执行文件名称和每个参数用单引号括起来,以明确什么是命令的一部分,什么不是。Ant 这样做是为了帮助用户在其<exec>
行为不符合预期时调试他们的 Ant 脚本。该消息纯粹是信息性的。
将记录的条目用单引号括起来是一种很好的做法,这样如果条目为空,您仍然可以看到它,例如:
用户''没有密码
否则你会看到:
没有用户密码
这是误导。在这种情况下,它只会通知您报价只是出于这个原因而不是记录数据的一部分。我认为这句话有点令人困惑,因为否定形式“不是命令的一部分”看起来有问题......
It is purely informative. It is there to indicate that the apostrophe (') symbol you see above is not actually within the command that has been used. It just "quotes" the string tokens you used in your command.
Example:
[exec] Current OS is Windows 10
[exec] Output redirected to property: git.timestamp
[exec] Executing 'cmd.exe' with arguments:
[exec] '/c'
[exec] 'git'
[exec] 'show'
[exec] '-s'
[exec] '--format=%ct'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
This indicates that you used /c git show -s --format=%ct inside cmd, and you can see that from the '/c', 'git' tokens. It just tells you to ignore the ' symbol. What it actually used is the git, show, -ss, etc. tokens in a chain, forming a full command.