TMPDIR not random and more observed

tempfile module caches gettempdir() at startup, so we need to be explicit.
refs #12
This commit is contained in:
boyska 2016-09-14 13:54:09 +02:00
parent 5b70da982a
commit 5c6f9b746f

View file

@ -40,7 +40,11 @@ class Larigira(object):
def main():
os.environ['TMPDIR'] = tempfile.mkdtemp(prefix='larigira')
tempfile.tempdir = os.environ['TMPDIR'] = os.path.join(
os.getenv('TMPDIR', '/tmp'),
'larigira.%d' % os.getuid())
if not os.path.isdir(os.environ['TMPDIR']):
os.makedirs(os.environ['TMPDIR'])
log_format = '%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s'
logging.basicConfig(level=logging.DEBUG if get_conf()['DEBUG'] else logging.INFO,
format=log_format,