Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactoring] Migrate from Popen() to run() #300

Closed
mips171 opened this issue May 25, 2021 · 2 comments · Fixed by #342
Closed

[refactoring] Migrate from Popen() to run() #300

mips171 opened this issue May 25, 2021 · 2 comments · Fixed by #342
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Easy issues for attracting Hacktoberfest participants.

Comments

@mips171
Copy link

mips171 commented May 25, 2021

From the Python docs

The recommended approach to invoking subprocesses is to use the run() function for all use cases it can handle. For more advanced use cases, the underlying Popen interface can be used directly.

The run() function was added in Python 3.5; if you need to retain compatibility with older versions, see the Older high-level API section.

Is this an "advanced use case"? Should we consider migrating to run()?

p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

@nemesifier
Copy link
Member

@nickberry17 I'm not such in a hurry to change it, but should be just a 2 line change:

p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p.communicate()

Initially this module supported also python2 but now we should be able to simplify that.

@nemesifier nemesifier added the enhancement New feature or request label May 26, 2021
@nemesifier nemesifier changed the title Migrate from Popen() to run() [refactoring] Migrate from Popen() to run() Jun 4, 2021
@devkapilbansal devkapilbansal added good first issue Good for newcomers Hacktoberfest Easy issues for attracting Hacktoberfest participants. labels Oct 14, 2021
@Aryamanz29
Copy link
Member

Aryamanz29 commented Dec 22, 2021

I would like to work on this @nemesisdesign

Aryamanz29 added a commit to Aryamanz29/openwisp-monitoring that referenced this issue Jan 27, 2022
nemesifier pushed a commit that referenced this issue Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Easy issues for attracting Hacktoberfest participants.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants