From 15be3b0264944301a60a4fe9c80ed2e66dab23bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sat, 8 Mar 2025 08:10:12 +0100 Subject: [PATCH] Add accessor for included pty instance Currently if I get passed a Process from by a method call I can check it for the Spawner and can already call special methods like hangup(). But there is no way to get access the the PTY used to create the Spawner so for example one can't call PTY#setTerminalSize or query any other properties. This now adds a new method pty() that returns this instance for further investigation and actions. --- core/org.eclipse.cdt.core.native/about.properties | 4 ++-- .../src/org/eclipse/cdt/utils/spawner/Spawner.java | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.native/about.properties b/core/org.eclipse.cdt.core.native/about.properties index dbc5e28b3ea..fbbb1de36a3 100644 --- a/core/org.eclipse.cdt.core.native/about.properties +++ b/core/org.eclipse.cdt.core.native/about.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2014, 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2014, 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -24,7 +24,7 @@ blurb=C/C++ Development Tooling Native Utilities\n\ Version: {featureVersion}\n\ Build id: {0}\n\ \n\ -Copyright (c) 2014, 2024 Contributors to the Eclipse Foundation +Copyright (c) 2014, 2025 Contributors to the Eclipse Foundation \n\ See the NOTICE file(s) distributed with this work for additional\n\ information regarding copyright ownership.\n\ diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java index 172a93aca0e..022c02e7f53 100644 --- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java +++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java @@ -423,6 +423,14 @@ public boolean isRunning() { return (raise(pid, SIG_NOOP) == 0); } + /** + * @since 6.3 + * @return the current pty instance for this spawner + */ + public PTY pty() { + return fPty; + } + private void exec(String[] cmdarray, String[] envp, String dirpath) throws IOException { String command = cmdarray[0]; SecurityManager s = System.getSecurityManager();