Skip to content

Commit 7ef9a19

Browse files
authored
Merge pull request github#9131 from github/igfoo/capture_output
Kotlin: Don't use capture_output or text
2 parents 168a184 + 02101fa commit 7ef9a19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

java/kotlin-extractor/build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def run_process(cmd, capture_output=False):
5656
cmd = ' '.join(map(quote_for_batch, cmd))
5757
print("Converted to Windows command: " + cmd)
5858
try:
59-
return subprocess.run(cmd, check=True, capture_output=capture_output)
59+
if capture_output:
60+
return subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
61+
else:
62+
return subprocess.run(cmd, check=True)
6063
except subprocess.CalledProcessError as e:
6164
print("In: " + os.getcwd(), file=sys.stderr)
6265
shell_cmd = cmd if is_windows() else shlex.join(cmd)

java/kotlin-extractor/kotlin_plugin_versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def version_string_to_tuple(version):
2424

2525
def get_single_version(fakeVersionOutput = None):
2626
# TODO: `shell=True` is a workaround to get CI working on Windows. It breaks the build on Linux.
27-
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True, shell=is_windows()).stderr if fakeVersionOutput is None else fakeVersionOutput
27+
versionOutput = subprocess.run(['kotlinc', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=is_windows()).stderr if fakeVersionOutput is None else fakeVersionOutput
2828
m = re.match(r'.* kotlinc-jvm ([0-9]+\.[0-9]+\.[0-9]+) .*', versionOutput)
2929
if m is None:
3030
raise Exception('Cannot detect version of kotlinc (got ' + str(versionOutput) + ')')

0 commit comments

Comments
 (0)