daemon: Remove session-related changes introduced by 68532cb.

This commit is contained in:
Tom Goff 2016-09-05 17:11:10 -04:00
parent 1c91f41742
commit e5e75756ea

View file

@ -14,6 +14,7 @@ that manages a CORE session.
import os, sys, tempfile, shutil, shlex, atexit, gc, pwd
import threading, time, random
import traceback
import subprocess
from core.api import coreapi
if os.uname()[0] == "Linux":
@ -289,8 +290,16 @@ class Session(object):
self.warn("Error writing hook '%s': %s" % (filename, e))
self.info("Running hook %s for state %s" % (filename, state))
try:
check_call(["/bin/sh", filename], cwd=self.sessiondir,
env=self.getenviron())
stdout = open(os.path.join(self.sessiondir,
filename + '.log'), 'w')
stderr = subprocess.STDOUT
except:
stdout = None
stderr = None
try:
check_call(["/bin/sh", filename], stdin=open(os.devnull, 'r'),
stdout=stdout, stderr=stderr, close_fds=True,
cwd=self.sessiondir, env=self.getenviron())
except Exception, e:
self.warn("Error running hook '%s' for state %s: %s" %
(filename, state, e))