aboutsummaryrefslogtreecommitdiffstats
path: root/mvc/execute.py
diff options
context:
space:
mode:
authorJesús Eduardo <heckyel@hyperbola.info>2017-09-11 17:47:17 -0500
committerJesús Eduardo <heckyel@hyperbola.info>2017-09-11 17:47:17 -0500
commit14738704ede6dfa6ac79f362a9c1f7f40f470cdc (patch)
tree31c83bdd188ae7b64d7169974d6f066ccfe95367 /mvc/execute.py
parenteb1896583afbbb622cadcde1a24e17173f61904f (diff)
downloadlibrevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.tar.lz
librevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.tar.xz
librevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.zip
rename mvc at lvc
Diffstat (limited to 'mvc/execute.py')
-rw-r--r--mvc/execute.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/mvc/execute.py b/mvc/execute.py
deleted file mode 100644
index 893d356..0000000
--- a/mvc/execute.py
+++ /dev/null
@@ -1,49 +0,0 @@
-"""execute.py -- Run executable programs.
-
-mvc.execute wraps the standard subprocess module in for MVC.
-"""
-
-import os
-import subprocess
-import sys
-
-CalledProcessError = subprocess.CalledProcessError
-
-def default_popen_args():
- retval = {
- 'stdin': open(os.devnull, 'rb'),
- 'stdout': subprocess.PIPE,
- 'stderr': subprocess.STDOUT,
- }
- if sys.platform == 'win32':
- retval['startupinfo'] = subprocess.STARTUPINFO()
- retval['startupinfo'].dwFlags |= subprocess.STARTF_USESHOWWINDOW
- return retval
-
-class Popen(subprocess.Popen):
- """subprocess.Popen subclass that adds MVC default behavior.
-
- By default we:
- - Use a /dev/null equivilent for stdin
- - Use a pipe for stdout
- - Redirect stderr to stdout
- - use STARTF_USESHOWWINDOW to not open a console window on win32
-
- These are just defaults though, they can be overriden by passing different
- values to the constructor
- """
- def __init__(self, commandline, **kwargs):
- final_args = default_popen_args()
- final_args.update(kwargs)
- subprocess.Popen.__init__(self, commandline, **final_args)
-
-def check_output(commandline, **kwargs):
- """MVC version of subprocess.check_output.
-
- This performs the same default behavior as the Popen class.
- """
- final_args = default_popen_args()
- # check_output doesn't use stdout
- del final_args['stdout']
- final_args.update(kwargs)
- return subprocess.check_output(commandline, **final_args)