mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
obtaining ruby processes for linux remote host fix
This commit is contained in:
@@ -199,6 +199,31 @@ public class ProcessListUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static List<ProcessInfo> parseLinuxOutputMacStyle(@NotNull String commandOnly, @NotNull String full) {
|
||||
List<MacProcessInfo> commands = doParseMacOutput(commandOnly);
|
||||
List<MacProcessInfo> fulls = doParseMacOutput(full);
|
||||
if (commands == null || fulls == null) return null;
|
||||
|
||||
TIntObjectHashMap<String> idToCommand = new TIntObjectHashMap<>();
|
||||
for (MacProcessInfo each : commands) {
|
||||
idToCommand.put(each.pid, each.commandLine);
|
||||
}
|
||||
|
||||
List<ProcessInfo> result = new ArrayList<>();
|
||||
for (MacProcessInfo each : fulls) {
|
||||
if (!idToCommand.containsKey(each.pid)) continue;
|
||||
|
||||
String command = idToCommand.get(each.pid);
|
||||
String name = PathUtil.getFileName(command);
|
||||
String args = each.commandLine.startsWith(command) ? each.commandLine.substring(command.length()).trim()
|
||||
: each.commandLine;
|
||||
|
||||
result.add(new ProcessInfo(each.pid, each.commandLine, name, args, command));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static List<MacProcessInfo> doParseMacOutput(String output) {
|
||||
List<MacProcessInfo> result = ContainerUtil.newArrayList();
|
||||
|
||||
Reference in New Issue
Block a user