mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 563015: Log exception if process.pid() fails
Change-Id: Ie9888e1e56b19086890caf221f0cbd97eafa817c
This commit is contained in:
parent
e033c50e28
commit
6386faff0d
1 changed files with 9 additions and 5 deletions
|
@ -306,14 +306,18 @@ public class ProcessConnector extends AbstractStreamsConnector {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<String> getWorkingDirectory() {
|
public Optional<String> getWorkingDirectory() {
|
||||||
long pid = process.pid();
|
|
||||||
try {
|
try {
|
||||||
if (Platform.getOS().equals(Platform.OS_LINUX)) {
|
long pid = process.pid();
|
||||||
Path procCwd = Files.readSymbolicLink(FileSystems.getDefault().getPath("/proc/" + pid + "/cwd")); //$NON-NLS-1$//$NON-NLS-2$
|
try {
|
||||||
return Optional.of(procCwd.toAbsolutePath().toString());
|
if (Platform.getOS().equals(Platform.OS_LINUX)) {
|
||||||
|
Path procCwd = Files.readSymbolicLink(FileSystems.getDefault().getPath("/proc/" + pid + "/cwd")); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
return Optional.of(procCwd.toAbsolutePath().toString());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
UIPlugin.log("Failed to obtain working directory of process id " + pid, e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UIPlugin.log("Failed to obtain working directory of process id " + pid, e); //$NON-NLS-1$
|
UIPlugin.log("Failed to obtain process id of terminal process", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue