OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 176 → Rev 177

/trunk/OpenConcerto/src/org/openconcerto/utils/prog/VMLauncher.java
16,11 → 16,11
import org.openconcerto.utils.FileUtils;
import org.openconcerto.utils.OSFamily;
import org.openconcerto.utils.ProcessStreams;
import org.openconcerto.utils.ProcessStreams.Action;
import org.openconcerto.utils.PropertiesUtils;
 
import java.io.File;
import java.io.IOException;
import java.lang.ProcessBuilder.Redirect;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.Arrays;
167,7 → 167,7
return restart(mainClass, Arrays.asList(args));
}
 
public static final Process restart(final Action action, final Class<?> mainClass, final String... args) throws IOException {
public static final Process restart(final Redirect action, final Class<?> mainClass, final String... args) throws IOException {
return restart(action, mainClass, Arrays.asList(args));
}
 
182,16 → 182,16
* @see #NO_RESTART
*/
public static final Process restart(final Class<?> mainClass, final List<String> args) throws IOException {
return restart(Action.CLOSE, mainClass, args);
return restart(ProcessStreams.DISCARD, mainClass, args);
}
 
public static final Process restart(final Action action, final Class<?> mainClass, final List<String> args) throws IOException {
public static final Process restart(final Redirect action, final Class<?> mainClass, final List<String> args) throws IOException {
if (Boolean.getBoolean(NO_RESTART))
return null;
final File wd = FileUtils.getWD();
final List<String> command = getNativeCommand(args);
if (command != null) {
return ProcessStreams.handle(new ProcessBuilder(command).directory(wd).start(), action);
return new ProcessBuilder(command).directory(wd).redirectErrorStream(true).redirectOutput(action).start();
} else {
try {
mainClass.getMethod("main", String[].class);
210,7 → 210,7
}
 
@Override
protected Action getStreamAction() {
protected Redirect getStreamRedirect() {
return action;
}
}.launch(mainClass.getName(), args);
278,7 → 278,7
return split(res);
}
 
protected final Process launch(final String mainClass) throws IOException {
public final Process launch(final String mainClass) throws IOException {
return this.launch(mainClass, Collections.<String> emptyList());
}
 
302,7 → 302,7
* @return the new Process.
* @throws IOException if the process couldn't be started.
*/
protected final Process launch(final String mainClass, final List<String> progParams) throws IOException {
public final Process launch(final String mainClass, final List<String> progParams) throws IOException {
final boolean debug = Boolean.getBoolean("launcher.debug");
final String javaBinary = getJavaBinary();
final File sameJava = new File(System.getProperty("java.home"), "bin/" + javaBinary);
353,17 → 353,15
System.err.println("Std out and err :");
}
 
final Process res = procBuilder.start();
ProcessStreams.handle(res, debug ? Action.REDIRECT : this.getStreamAction());
 
return res;
procBuilder.redirectErrorStream(true).redirectOutput(debug ? Redirect.INHERIT : this.getStreamRedirect());
return procBuilder.start();
}
 
protected void modifyEnv(Map<String, String> environment) {
}
 
protected Action getStreamAction() {
return Action.CLOSE;
protected Redirect getStreamRedirect() {
return ProcessStreams.DISCARD;
}
 
protected boolean enableRemoteDebug(Properties props) {