Commit a01439eb authored by Ilia Zakoulov's avatar Ilia Zakoulov Committed by intellij-monorepo-bot
Browse files

PY-60900: Rename hasPty to isRunWithPty and add doc for more comprehensive

GitOrigin-RevId: 5c50db7cc063f90b67840b3a89767449aeae779f
parent f6d8362f
Showing with 15 additions and 9 deletions
+15 -9
...@@ -36,19 +36,25 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot ...@@ -36,19 +36,25 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
@NotNull private final PyRemotePathMapper myPathMapper; @NotNull private final PyRemotePathMapper myPathMapper;
private final List<PathMappingSettings.PathMapping> myFileMappings = new ArrayList<>(); private final List<PathMappingSettings.PathMapping> myFileMappings = new ArrayList<>();
@NotNull private final PyRemoteSocketToLocalHostProvider myRemoteSocketProvider; @NotNull private final PyRemoteSocketToLocalHostProvider myRemoteSocketProvider;
private final boolean myHasPty; /**
* Indicates if [myProcess] is launched with PTY.
* It changes the logic of readerOptions, so it can break the output if the [myProcess] has been launched without PTY and that value is
* set as true.
* Look at PY-60900, PY-55322.
*/
private final boolean myIsRunWithPty;
private PyRemoteProcessHandler(@NotNull RemoteProcess process, private PyRemoteProcessHandler(@NotNull RemoteProcess process,
@NotNull String commandLine, @NotNull String commandLine,
@NotNull Charset charset, @NotNull Charset charset,
@Nullable PyRemotePathMapper pathMapper, @Nullable PyRemotePathMapper pathMapper,
@NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider, @NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider,
boolean hasPty) { boolean isRunWithPty) {
super(process, commandLine, charset); super(process, commandLine, charset);
myRemoteSocketProvider = remoteSocketProvider; myRemoteSocketProvider = remoteSocketProvider;
myPathMapper = pathMapper != null ? pathMapper : new PyRemotePathMapper(); myPathMapper = pathMapper != null ? pathMapper : new PyRemotePathMapper();
myHasPty = hasPty; myIsRunWithPty = isRunWithPty;
putUserData(PythonRemoteInterpreterManager.PATH_MAPPING_SETTINGS_KEY, pathMapper); putUserData(PythonRemoteInterpreterManager.PATH_MAPPING_SETTINGS_KEY, pathMapper);
} }
...@@ -116,8 +122,8 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot ...@@ -116,8 +122,8 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
@NotNull Charset charset, @NotNull Charset charset,
@Nullable PyRemotePathMapper pathMapper, @Nullable PyRemotePathMapper pathMapper,
@NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider, @NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider,
boolean hasPty) { boolean isRunWithPty) {
return new PyRemoteProcessHandler(remoteProcess, commandLine, charset, pathMapper, remoteSocketProvider, hasPty); return new PyRemoteProcessHandler(remoteProcess, commandLine, charset, pathMapper, remoteSocketProvider, isRunWithPty);
} }
@NotNull @NotNull
...@@ -131,7 +137,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot ...@@ -131,7 +137,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
@Override @Override
public void notifyTextAvailable(@NotNull String text, @NotNull Key outputType) { public void notifyTextAvailable(@NotNull String text, @NotNull Key outputType) {
if (hasPty()) { if (isRunWithPty()) {
boolean foundPyCharmFileMapping = handlePyCharmFileMapping(text); boolean foundPyCharmFileMapping = handlePyCharmFileMapping(text);
if (!foundPyCharmFileMapping) { if (!foundPyCharmFileMapping) {
super.notifyTextAvailable(text, outputType); super.notifyTextAvailable(text, outputType);
...@@ -169,13 +175,13 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot ...@@ -169,13 +175,13 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
} }
} }
public boolean hasPty() { public boolean isRunWithPty() {
return myHasPty; return myIsRunWithPty;
} }
@Override @Override
protected BaseOutputReader.@NotNull Options readerOptions() { protected BaseOutputReader.@NotNull Options readerOptions() {
if (hasPty()) { if (isRunWithPty()) {
return BaseOutputReader.Options.forTerminalPtyProcess(); return BaseOutputReader.Options.forTerminalPtyProcess();
} }
return super.readerOptions(); return super.readerOptions();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment