diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-05 14:02:49 +0100 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-06 20:22:35 +0100 |
commit | 356950579c2b155f9d41c04ed63c7efde561b43a (patch) | |
tree | dc5fe36bf61ce25d85aaac7994545385b0bc6bff /src/conf_mode | |
parent | e0f13b79a669e7fc8cadac8757b2f5fbbf51dc99 (diff) | |
download | vyos-1x-356950579c2b155f9d41c04ed63c7efde561b43a.tar.gz vyos-1x-356950579c2b155f9d41c04ed63c7efde561b43a.zip |
util: T2226: improve popen, cmd and add run
improves open and cmd adds a new help function run.
the extra optional arguments provide all the features of
subprocess used by every module of VyOS.
popen matches closely subprocess.Popen
cmd matches closely subprocess.check_output
run matches closely subprocess.call and os.system
popen returns the string and errord code
cmd returns the string and raise on error
(the class can be defined the default is OSError)
run returns the return code of the command
the options are:
shell=None, the code auto-detect is a shell is required
decode=None, use .decode() otherwise the encoding will be used
env=None, universal_newlines=None: as per subprocess.Popen
input=None, timeout=None, stdout=PIPE, stderr=STDOUT,
as per Popen.communicate
Diffstat (limited to 'src/conf_mode')
0 files changed, 0 insertions, 0 deletions