0

I wrote a small c program like this:

#include<stdio.h>
#include<windows.h>

void main()
{
  fputs("test\r\n", stderr);
  fflush(stderr);
  ExitProcess(-1);
}

and included it like this in ccnet.config:

<project name="foobar">
  <tasks>
    <exec>
     <executable>C:\temp\test.exe</executable>
    </exec>
  </tasks>
</project>

When I forced the foobar project, I got not output whatsoever in the project report.

Why?

I may also mention that if I deliberately misspell the exe-filename, I get an exception (which I appreciate).

Edit: When debugging CruiseControl.NET, writing a test that tries to run the exe file that looks like this

[Test]
public void FooTest()
{
    const string xml = "<exec executable=\"C:\\temp\\test.exe\"><buildArgs></buildArgs></exec>";

    task = (ExecutableTask) NetReflector.Read(xml);

    var result = (IntegrationResult) IntegrationResult();
    result.Label = "1.0";
    result.BuildCondition = BuildCondition.ForceBuild;
    result.WorkingDirectory = @"c:\temp\";
    result.ArtifactDirectory = @"c:\temp\";

    task.Run(result);

    Assert.AreEqual(IntegrationStatus.Failure, result.Status);

    Assert.IsFalse(task.WasSuccessful);
    var firstTaskResult = (ProcessTaskResult)result.TaskResults[0];
    Debug.WriteLine(firstTaskResult.Data);
}

The debug console will output xml like this:

<buildresults>
    <task>
        <buildArgs />
        <buildTimeoutSeconds>600</buildTimeoutSeconds>
        <baseDirectory />
        <dynamicValues />
        <environment />
        <executable>C:\temp\test.exe</executable>
        <priority>Normal</priority>
        <successExitCodes />
    </task>
    <message level="Error">test</message>
</buildresults>

(note, I did beautify this xml before adding it here).

Anders Lindén
  • 6,839
  • 11
  • 56
  • 109

0 Answers0