Project

General

Profile

Task #3154

Update use of Python subprocess for >=3.5

Added by Eric Irrgang 9 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
core library
Target version:
-
Difficulty:
uncategorized
Close

Description

We now require Python 3.5, which means we have improved handling of subprocess stdio. Ref subprocess.run().

We can replace instances of old-style calls, like subprocess.check_output() -> subprocess.run() to improve readability and reduce risk of buffer-flush deadlocks.

See, for instance, python_packaging/src/gmxapi/commandline.py

Associated revisions

Revision 24a2643e (diff)
Added by M. Eric Irrgang 3 months ago

Modernize some Python subprocess calls.

subprocess.run() is now the recommended high-level interface for the
subprocess module. It trivially replaces subprocess.check_output and
usually simplifies subprocess.Popen use cases. It has less error prone
semantics for str vs. bytes I/O. subprocess.run() is less prone to
PIPE buffer deadlocks and we should use the modern interface in order to
benefit from future improvements, as well.

A handful of more intricate subprocess.Popen() usages are left, but I
think we can say that, along with d80618cb, this change
Fixes #3154

Change-Id: I88f4eaabd8504d3800692c9617571103b2528cf9

History

#1 Updated by Anonymous 3 months ago

  • Status changed from New to Resolved

Also available in: Atom PDF