dont require single process match for fversion

This commit is contained in:
Doug MacEachern 2008-05-12 22:07:22 +00:00
parent 81a19482a0
commit 109c6354bd
1 changed files with 11 additions and 8 deletions

View File

@ -50,16 +50,19 @@ public class FileVersionInfo extends SigarCommandBase {
public void output(String[] args) throws SigarException { public void output(String[] args) throws SigarException {
for (int i=0; i<args.length; i++) { for (int i=0; i<args.length; i++) {
String exe = args[i]; String exe = args[i];
if (!new File(exe).exists()) { if (new File(exe).exists()) {
output(exe);
}
else {
long[] pids = this.shell.findPids(exe);
for (int j=0; j<pids.length; j++) {
try { try {
exe = sigar.getProcExe(exe).getName(); output(sigar.getProcExe(pids[j]).getName());
} catch (SigarException e) { } catch (SigarException e) {
println(exe + ": " + e.getMessage()); println(exe + ": " + e.getMessage());
continue;
} }
} }
output(exe); }
println("\n------------------------\n");
} }
} }