Broken output in Exec on Windows

(Sten Roger Sandvik) #1

I have a problem with certain output using Exec on Windows. When executing npm list using Exec task the output on Windows is messed up. I have seen this with other commands too. Here’s an example:

task npmList(type: Exec) {
  commandLine 'cmd', '/c', 'npm', 'list'

The output on unix (mac):

example@1.1.1 /Volumes/C/Users/srs/Desktop/workspace
└─┬ safefs@3.1.1
  └── graceful-fs@2.0.3

When running on windows using the standard command shell:

example@1.1.1 C:\Users\srs\Desktop\workspace
Γö£ΓöÇΓöÇ graceful-fs@2.0.3
ΓööΓöÇΓöÇ safefs@3.1.1

When running npm list directly on windows:

example@1.1.1 /Volumes/C/Users/srs/Desktop/workspace
└─┬ safefs@3.1.1
  └── graceful-fs@2.0.3

If I use the Java ProcessBuilder directly then it works just fine. It seems to me that it has something to do with StreamsForwarder used in AbstractExecHandleBuilder.

Any idea on how to fix this?

Sten Roger

(Sterling Greene) #2

I think you might be seeing this:

(Lari Hotari) #3

GRADLE-3329 has been fixed by . This will be included in 3.2-rc-1 .