gpt4 book ai didi

windows - 当批处理系列中没有负面导出时,TFS 构建流程中的批处理如何以 -1 退出

转载 作者:可可西里 更新时间:2023-11-01 11:47:20 25 4
gpt4 key购买 nike

我有一批通过 TFS 一直失败,退出为 -1 .

被调用的批处理没有否定退出。它调用而不是直接运行其他一些可以返回负退出代码的批处理和命令行工具,但它们都是 call ed,没有直接跑,设置失败点的时候,我exit /b 1exit 1

....targets (350): The command "call C:\Build\BuildTools\callSigning.bat" exited with code -1.

远程进入失败的盒子并在那里运行批处理不会产生错误!

什么可能触发此 exit -1使用 MSBuild?是否有一些我只是不知道的奇怪的幕后警告?

在 .proj 文件中,我有这样一行:

<Exec Command="call $(SrcRoot)\BuildTools\callSigning.bat" ContinueOnError="false"/>

并且该批处理没有负退出代码...

@echo off
pushd %~dp0

IF EXIST "%~dp0signVerification.log" echo Cert renewed and successfully signed once for this TFS job already&&exit 0

IF NOT EXIST .\renew_certificate.bat echo missing renew_certificate.bat&&exit 1

SETLOCAL EnableDelayedExpansion EnableExtensions

FOR /L %%T IN (1,1,5) DO (
call %~dp0renew_certificate.bat
IF NOT "!passed!"=="true" IF "!errorlevel!"=="0" Set passed=true&&exit /b 0
IF NOT "!passed!"=="true" echo Re-trying signing iteration %%T && call ping 127.0.0.1 -n 61 > nul
)

IF NOT "%passed%"=="true" echo Signing did not pass && exit /b 1
exit /b 0

最佳答案

这可能是 Exec 将您的 Command 文本放在临时目录中的 .exec.cmd 文件中的副作用并调用 cmd.exe/C [that temporary .exec.cmd]。因此,路径可能不是您所想的那样,并且可能会出现涉及引号的错误。当我使用 Exec 时,我几乎没有机会并传递显式路径,例如:

<PropertyGroup>
<SomeCommand>
"$(MSBuildThisFileDirectory)SomeFile.bat" "$(SomeToolsDir)" "$(SomeLogFilePath)"
</SomeCommand>
</PropertyGroup>
<Exec WorkingDirectory="$(SomeToolsDir)" Command="$(SomeCommand)" />

SomeFile.bat 中:

SET SomeToolsDir=%~1
SET SomeLogFilePath=%~2
SOMEPROGRAM.EXE -logfilepath "%SomeLogFilePath%"

关于windows - 当批处理系列中没有负面导出时,TFS 构建流程中的批处理如何以 -1 退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41838923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com