[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-08 Thread Gili (JIRA)

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

Gili commented on SUREFIRE-1369:


Not sure if I'll end up submitting a patch for this, but I filed SUREFIRE-1371 
to get the ball rolling.

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-08 Thread Tibor Digana (JIRA)

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

Tibor Digana commented on SUREFIRE-1369:


Such sanity check is what we really miss and the plugin should seriously fail 
with verbose error.
Please help us with fixing it in GitHub. This needs to be done in a new Jira 
issue and class {{AbstractSurefireMojo}}, there should be integration test as 
well.

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-08 Thread Gili (JIRA)

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

Gili commented on SUREFIRE-1369:


It turns out that my mistake was mixing {{0}} with 
{{}} when the latter contained system properties.

If {{forkCount}} is zero and {{}} is set, can you please issue a 
warning that the latter will be ignored? It would help prevent this kind of 
mistake in the future.

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-03 Thread Gili (JIRA)

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

Gili commented on SUREFIRE-1369:


(Filed https://issues.apache.org/jira/browse/MNG-6225 in case this is a problem 
in Maven core)

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-03 Thread Gili (JIRA)

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

Gili commented on SUREFIRE-1369:


[~tibor17] No, I don't think `System.setOut(...)` is relevant. My code should 
only be affected by stdout being redirected on an operating-system level. As 
mentioned above, I am configuring Surefire **not** to fork for each test. If it 
is ignoring this configuration for some reason then we'd have a problem. 
Forking processes implies redirection on an operating-system level because 
you're redirecting stdout of each child process to the parent in order to 
centralize the output of all test results in the same process.

If you are certain that Surefire is not doing this sort of redirection (when 
using the configuration posted above) then it sounds to me like this is a 
problem in Maven core.

> Is there any segmentation fault or an exception?

Not exactly. The method call fails which means that colors are never enabled. 
If I then output ANSI colors to the console, the raw control characters are 
visible instead of being converted to colors.

> One more question, why you are interested in JNDI and such things 
> GetStdHandle?

My API outputs colored diffs (see 
https://bitbucket.org/cowwoc/requirements/wiki/Home#markdown-header-string-diff).
 In order to output colors under Windows 10, you are forced to use JNI. There 
is no other way.

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-02 Thread Tibor Digana (JIRA)

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

Tibor Digana commented on SUREFIRE-1369:


One more question, why you are interested in JNDI and such things 
{{GetStdHandle}}?
Is it your interest or commercial test?

> 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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-02 Thread Tibor Digana (JIRA)

[ 
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}
>   0
>   false
>   false
>   false
> {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)


[jira] [Commented] (SUREFIRE-1369) No way to output ANSI colors when running under Surefire

2017-05-02 Thread Gili (JIRA)

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

Gili commented on SUREFIRE-1369:


> Redirecting stream and forking has nothing to do with ANSI colors.

In order to enable ANSI support under Windows 10, one must invoke the following 
native code:

{code}
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
dwMode = dwOldMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (! SetConsoleMode( hStdout, dwMode ) ){
CloseHandle( hStdout );
return 2;
}
{code}

If stdout was redirected, {{GetStdHandle()}} will return 
{{INVALID_HANDLE_VALUE}}.

In light of that: who is redirecting stdout? Is it Surefire, or Maven? Which 
component should I file a bug report against? (Thank you!)

> 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}
>   0
>   false
>   false
>   false
> {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)