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
|
||||
|
||||
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 = ''
|
||||
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,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
cwd=plexpy.CONFIG.SCRIPTS_FOLDER)
|
||||
cwd=self.script_folder)
|
||||
|
||||
timer = threading.Timer(self.script_timeout, kill_script, (process,))
|
||||
self.script_killed = False
|
||||
|
||||
try:
|
||||
timer.start()
|
||||
output, error = process.communicate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue