mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Cleanup kill script
This commit is contained in:
parent
ae2227959e
commit
45cd8b8a00
1 changed files with 8 additions and 8 deletions
|
@ -2163,23 +2163,23 @@ class Scripts(object):
|
||||||
return scripts
|
return scripts
|
||||||
|
|
||||||
def run_script(self, script):
|
def run_script(self, script):
|
||||||
|
def kill_script(process):
|
||||||
|
logger.warn(u"PlexPy Notifiers :: Script exceeded timeout limit of %d seconds. "
|
||||||
|
"Script killed." % self.script_timeout)
|
||||||
|
process.kill()
|
||||||
|
self.script_killed = True
|
||||||
|
|
||||||
|
self.script_killed = False
|
||||||
output = error = ''
|
output = error = ''
|
||||||
try:
|
try:
|
||||||
def kill_script(process):
|
|
||||||
logger.warn(u"PlexPy Notifiers :: Script exceeded timeout limit of %d seconds. "
|
|
||||||
"Script killed." % self.script_timeout)
|
|
||||||
process.kill()
|
|
||||||
self.script_killed = True
|
|
||||||
|
|
||||||
process = subprocess.Popen(script,
|
process = subprocess.Popen(script,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
cwd=plexpy.CONFIG.SCRIPTS_FOLDER)
|
cwd=self.script_folder)
|
||||||
|
|
||||||
timer = threading.Timer(self.script_timeout, kill_script, (process,))
|
timer = threading.Timer(self.script_timeout, kill_script, (process,))
|
||||||
self.script_killed = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
timer.start()
|
timer.start()
|
||||||
output, error = process.communicate()
|
output, error = process.communicate()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue