mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 11:20:44 +07:00
Cleanup (logging method moved to a better place)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,11 +17,11 @@ package com.intellij.testFramework.vcs;
|
||||
|
||||
import com.intellij.execution.process.CapturingProcessHandler;
|
||||
import com.intellij.execution.process.ProcessOutput;
|
||||
import com.intellij.openapi.diagnostic.LogUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.util.EnvironmentUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -107,10 +107,11 @@ public class TestClientRunner {
|
||||
}
|
||||
|
||||
if (result.isTimeout()) {
|
||||
String processList = EnvironmentUtil.getProcessList();
|
||||
String processList = LogUtil.getProcessList();
|
||||
handler.destroyProcess();
|
||||
throw new RuntimeException("Timeout waiting for VCS client to finish execution:\n" + processList);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,14 @@
|
||||
*/
|
||||
package com.intellij.openapi.diagnostic;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LogUtil {
|
||||
private LogUtil() { }
|
||||
|
||||
@@ -33,4 +38,17 @@ public class LogUtil {
|
||||
logger.debug(String.format(format, args));
|
||||
}
|
||||
}
|
||||
|
||||
public static String getProcessList() {
|
||||
try {
|
||||
@SuppressWarnings("SpellCheckingInspection") Process process = new ProcessBuilder()
|
||||
.command(SystemInfo.isWindows ? new String[]{System.getenv("windir") + "\\system32\\tasklist.exe", "/v"} : new String[]{"ps", "a"})
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
return FileUtil.loadTextAndClose(process.getInputStream());
|
||||
}
|
||||
catch (IOException e) {
|
||||
return ExceptionUtil.getThrowableText(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.concurrency.FixedFuture;
|
||||
@@ -33,7 +32,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -198,17 +196,6 @@ public class EnvironmentUtil {
|
||||
return Collections.unmodifiableMap(newEnv);
|
||||
}
|
||||
|
||||
public static String getProcessList() {
|
||||
String diagnostics;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(SystemInfo.isWindows ? System.getenv("windir") +"\\system32\\tasklist.exe /v" : "ps a");
|
||||
diagnostics = StreamUtil.readText(p.getInputStream());
|
||||
}
|
||||
catch (IOException e) {
|
||||
diagnostics = ExceptionUtil.getThrowableText(e);
|
||||
}
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
private static class ProcessKiller {
|
||||
private final Process myProcess;
|
||||
|
||||
Reference in New Issue
Block a user