File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
ruby-tools/src/main/java/de/saumya/mojo/ruby/script Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import java .io .File ;
7
7
import java .io .IOException ;
8
+ import java .nio .file .Files ;
8
9
import java .util .List ;
9
10
import java .util .Map ;
10
11
@@ -105,7 +106,32 @@ protected void doExecute(final File launchDirectory,
105
106
if (outputFile != null ) {
106
107
java .setOutput (outputFile );
107
108
}
108
- java .execute ();
109
+ java .setLogError (true );
110
+ File tempFile = null ;
111
+ try {
112
+ tempFile = File .createTempFile ("jruby-ant-launcher-" , ".log" );
113
+ tempFile .deleteOnExit ();
114
+ java .setError (tempFile );
115
+ java .execute ();
116
+ }
117
+ catch (IOException e ) {
118
+ logger .warn ("can not create tempfile for stderr" );
119
+ java .execute ();
120
+ }
121
+ finally {
122
+ if (tempFile != null ) {
123
+ try {
124
+ byte [] encoded = Files .readAllBytes (tempFile .toPath ());
125
+ if (encoded .length > 0 ) {
126
+ logger .error (new String (encoded ));
127
+ }
128
+ }
129
+ catch (IOException e ) {
130
+ logger .warn ("can not read error file" );
131
+ }
132
+ tempFile .delete ();
133
+ }
134
+ }
109
135
}
110
136
111
137
private Project createAntProject () {
You can’t perform that action at this time.
0 commit comments