Check-in [7aa0a47c0b]
Overview
| Comment: | Fix/merge popen and shell variant |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
7aa0a47c0be3d0498bdaea1fb50436d8 |
| User & Date: | mario on 2017-10-14 11:42:45 |
| Other Links: | manifest | tags |
Context
|
2017-10-14
| ||
| 18:18 | Fix orgi action.run reference; implemented .quote override check-in: 81a043699c user: mario tags: trunk | |
| 11:42 | Fix/merge popen and shell variant check-in: 7aa0a47c0b user: mario tags: trunk | |
|
2017-10-13
| ||
| 21:29 | Add a shell version, new flags; some more docs. check-in: 4061ff33a6 user: mario tags: trunk | |
Changes
Modified contrib/st2subprocess.py from [90d8471ab8] to [357a6531ee].
1 2 3 4 | # encoding: utf-8 # api: streamtuner2 # title: win32/subprocess # description: Utilizes subprocess spawning or win32 API instead of os.system | | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# encoding: utf-8
# api: streamtuner2
# title: win32/subprocess
# description: Utilizes subprocess spawning or win32 API instead of os.system
# version: 0.3.1
# depends: streamtuner2 > 2.2.0, python >= 2.7
# priority: optional
# config:
# { name: cmd_spawn, type: select, select: "popen|shell|call|execv|spawnv|pywin32|win32api|system", value: popen, description: Spawn method }
# { name: cmd_flags, type: select, select: "none|nowait|detached|nowaito|all|sw_hide||sw_minimize|sw_show", value: nowait, description: Process creation flags (win32) }
# type: handler
# category: io
|
| ︙ | ︙ | |||
97 98 99 100 101 102 103 |
# flags
flags = self.flagmap[conf.cmd_flags] if conf.windows and conf.cmd_flags in self.flagmap else 0
# debug
log.EXEC("st2subprocess:", args, "creationflags=%s"%flags)
#-- Popen → https://docs.python.org/2/library/subprocess.html#popen-constructor
v = conf.cmd_spawn
| | > > > < < < < < < | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# flags
flags = self.flagmap[conf.cmd_flags] if conf.windows and conf.cmd_flags in self.flagmap else 0
# debug
log.EXEC("st2subprocess:", args, "creationflags=%s"%flags)
#-- Popen → https://docs.python.org/2/library/subprocess.html#popen-constructor
v = conf.cmd_spawn
if v in ("popen", "shell"):
#-- Popen w/ shell=True and string cmd
if (v=="shell"):
args = [cmd]
log.POPEN(
subprocess.Popen(args, shell=(v=="shell"), creationflags=flags).__dict__
)
#-- call → https://docs.python.org/2/library/subprocess.html#replacing-os-system
elif v == "call":
log.CALL(
subprocess.call(args, creationflags=flags).__dict__
)
#-- execv → https://docs.python.org/2/library/os.html#os.execv
elif v == "execv":
|
| ︙ | ︙ |