How to ignore output from executable file using CruiseControl.Net assembly?

I run a small search and replace utility called fart.exe (yes, fart, as in Find and Replace Text) as part of my CC assembly. It works great.

The problem is that the FART displays a bit of an ASCII spinner during operation, consisting of a pipe, dash, slash ... | / -. There is no way to suppress this counter, and CC considers these small characters to be error messages and the assembly is not performed. I tried:

  • adding these characters as successexitcodes in CC is the same result, apparently only ints work
  • Calling fart through a batch file with ECHO OFF - it still displays the counter and leads to a build failure

Any other ideas?

<exec>
<executable>C:\fart.exe</executable>
<buildArgs>myfile.txt string1 string2</buildArgs>
<successExitCodes>1,0</successExitCodes>
</exec>
+3
7

, :

  • () . CC - , ...
  • msbuild cc. CC .

, CC , , !

+1

ci. , , NUL.

, spinner stderr. "2 > NUL" , , spinner stderr.

- ?

+2

. , FART errorlevel = 1, , errorlevel = 0, " " " " .. , errorlevel 0 1, . .

+1

fart.exe , , .

fart.exe % errorlevel% . 1, % errorlevel%, 1, Jenkins.

, :

REM standard "fart.exe" error-handling block; 9009 (missing program) is bad, anything else above 0 is OK and should be reset to 0 for standard handling
if ERRORLEVEL 9009 (
    REM do nothing
) else (
    if ERRORLEVEL 1 CMD /C EXIT 0
)

REM ensure that we exit with the current errorlevel context...
exit %errorlevel%

ECHO OFF fart.exe % errorlevel% 0, , , , .

, -!

+1

successExitCodes int. :

  • , , ( ) .
  • non ints successExitCodes , fart . , , robocopy.
0

In command line applications, you can redirect output to a file using the '>' character. The application call will look like this:

fart.exe myfile.txt string1 string2> myoutput.txt

Adding redirects to the buildArgs property should do the trick.

0
source

This line seems to work using fart:

<exec program="fart.exe" commandline="${filename} 1.0 1.1" verbose="true" failonerror="false" />

However, I am not sure that failonerror can be handled otherwise.

0
source

Source: https://habr.com/ru/post/1724423/


All Articles