diff options
author | Jonah Graham | 2021-04-23 15:21:16 +0000 |
---|---|---|
committer | Jonah Graham | 2021-04-23 15:21:38 +0000 |
commit | 6386faff0de0f95e6b47fbd13d049c85e9ecf7a5 (patch) | |
tree | f16985a8d6b772c1ec04fbe262c35a58a3f81f39 | |
parent | e033c50e2820cb7a83e73a61d03a0151b85d4232 (diff) | |
download | org.eclipse.cdt-6386faff0de0f95e6b47fbd13d049c85e9ecf7a5.tar.gz org.eclipse.cdt-6386faff0de0f95e6b47fbd13d049c85e9ecf7a5.tar.xz org.eclipse.cdt-6386faff0de0f95e6b47fbd13d049c85e9ecf7a5.zip |
Bug 563015: Log exception if process.pid() fails
Change-Id: Ie9888e1e56b19086890caf221f0cbd97eafa817c
-rw-r--r-- | terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessConnector.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessConnector.java b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessConnector.java index aa2337c70d3..63721e7e1a5 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessConnector.java +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessConnector.java @@ -306,14 +306,18 @@ public class ProcessConnector extends AbstractStreamsConnector { */ @Override public Optional<String> getWorkingDirectory() { - long pid = process.pid(); try { - 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()); + long pid = process.pid(); + try { + 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) { - 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(); } |