[ 
https://issues.apache.org/jira/browse/SUREFIRE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15994303#comment-15994303
 ] 

Tibor Digana commented on SUREFIRE-1369:
----------------------------------------

We call {{System.setOut(...)}} in Java.
Is this what you call {{"redirected"}}?
We must do this in order to associate std/out/err with test method.
We do this around {{Provider}} and the provider itself decides whether the logs 
go to console or to file {{target/surefire-reports/my.class-output.txt}}.
Is there any segmentation fault or an exception?
ANSI colors are under the control of Maven.
Here Surefire is only using high-level internal API to utilize low-level API 
implemented in Maven.
Forked JVM does not have chance to use ANSI colors.

> No way to output ANSI colors when running under Surefire
> --------------------------------------------------------
>
>                 Key: SUREFIRE-1369
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1369
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.20
>         Environment: Windows 10 64-bit, 10.0.14393
>            Reporter: Gili
>            Assignee: Tibor Digana
>
> I invoke the following native code from inside a unit test:
> {{GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &sbi)}}
> It fails with {{GetLastError() == ERROR_INVALID_HANDLE}} indicating that 
> stdout has been redirected.
> I am blocked by the fact that it isn't possible to use ANSI colors under 
> Windows when stdout has been redirected. I tried configuring Surefire with:
> {code}
>       <forkCount>0</forkCount>
>       <redirectTestOutputToFile>false</redirectTestOutputToFile>
>       <useFile>false</useFile>
>       <printSummary>false</printSummary>
> {code}
> but stdout is still getting redirected. Is it possible to configure Surefire 
> to use the default stdout (connected to a terminal) without redirection?
> Expected behavior: Surefire shouldn't fork the JVM or redirect stdout when 
> {{forkCount}} is zero and {{useFile}} is false.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to