mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
pep8.py doesn't like our EOF marker (PY-11094)
This commit is contained in:
@@ -88,7 +88,7 @@ public class PyStructuredDocstringFormatter {
|
||||
|
||||
|
||||
final ProcessOutput output = PySdkUtil.getProcessOutput(new File(sdkHome).getParent(), new String[]{sdkHome, formatter},
|
||||
null, 5000, data);
|
||||
null, 5000, data, true);
|
||||
if (output.isTimeout()) {
|
||||
LOG.info("timeout when calculating docstring");
|
||||
return null;
|
||||
|
||||
@@ -84,18 +84,20 @@ public class PySdkUtil {
|
||||
@NonNls String[] command,
|
||||
@Nullable @NonNls String[] addEnv,
|
||||
final int timeout) {
|
||||
return getProcessOutput(homePath, command, addEnv, timeout, null);
|
||||
return getProcessOutput(homePath, command, addEnv, timeout, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process and returns its stdout and stderr outputs as lists of lines.
|
||||
* Waits for process for possibly limited duration.
|
||||
*
|
||||
*
|
||||
* @param homePath process run directory
|
||||
* @param command command to execute and its arguments
|
||||
* @param addEnv items are prepended to same-named values of inherited process environment.
|
||||
* @param timeout how many milliseconds to wait until the process terminates; non-positive means infinity.
|
||||
* @param stdin the data to write to the process standard input stream
|
||||
* @param needEOFMarker
|
||||
* @return a tuple of (stdout lines, stderr lines, exit_code), lines in them have line terminators stripped, or may be null.
|
||||
*/
|
||||
@NotNull
|
||||
@@ -103,10 +105,11 @@ public class PySdkUtil {
|
||||
@NonNls String[] command,
|
||||
@Nullable @NonNls String[] addEnv,
|
||||
final int timeout,
|
||||
@Nullable byte[] stdin) {
|
||||
final ProcessOutput failure_output = new ProcessOutput();
|
||||
@Nullable byte[] stdin,
|
||||
boolean needEOFMarker) {
|
||||
final ProcessOutput failureOutput = new ProcessOutput();
|
||||
if (homePath == null || !new File(homePath).exists()) {
|
||||
return failure_output;
|
||||
return failureOutput;
|
||||
}
|
||||
try {
|
||||
List<String> commands = new ArrayList<String>();
|
||||
@@ -122,7 +125,7 @@ public class PySdkUtil {
|
||||
final OutputStream processInput = processHandler.getProcessInput();
|
||||
assert processInput != null;
|
||||
processInput.write(stdin);
|
||||
if (SystemInfo.isWindows) {
|
||||
if (SystemInfo.isWindows && needEOFMarker) {
|
||||
processInput.write(SUBSTITUTE);
|
||||
processInput.flush();
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
ArrayUtil.toStringArray(options),
|
||||
new String[] { "PYTHONUNBUFFERED=1" },
|
||||
10000,
|
||||
collectedInfo.fileText.getBytes());
|
||||
collectedInfo.fileText.getBytes(), false);
|
||||
|
||||
Results results = new Results(collectedInfo.level);
|
||||
if (output.isTimeout()) {
|
||||
|
||||
Reference in New Issue
Block a user