From 8cd358e35876839211f4e0bbd75b380843776441 Mon Sep 17 00:00:00 2001 From: Kload Date: Thu, 21 Nov 2013 09:46:41 +0100 Subject: [PATCH] Fix PID issue --- yunohost.tac | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/yunohost.tac b/yunohost.tac index dba98f68..0a972b58 100755 --- a/yunohost.tac +++ b/yunohost.tac @@ -116,9 +116,10 @@ def http_exec(request, **kwargs): with open('/var/run/yunohost.pid', 'r'): raise YunoHostError(1, _("A YunoHost command is already running")) except IOError: - with open('/var/run/yunohost.pid', 'w') as f: - f.write('ldap') - os.system('chmod 400 /var/run/yunohost.pid') + if dict['function'].split('.')[1] != 'tools_postinstall': + with open('/var/run/yunohost.pid', 'w') as f: + f.write('ldap') + os.system('chmod 400 /var/run/yunohost.pid') with open('/etc/yunohost/passwd', 'w') as f: f.write(request.getPassword()) os.system('chmod 400 /etc/yunohost/passwd') @@ -127,8 +128,10 @@ def http_exec(request, **kwargs): except KeyboardInterrupt, EOFError: raise YunoHostError(125, _("Interrupted")) finally: - os.remove('/etc/yunohost/passwd') - os.remove('/var/run/yunohost.pid') + try: + os.remove('/etc/yunohost/passwd') + os.remove('/var/run/yunohost.pid') + except: pass if result is None: result = {} if len(yunohost.win) > 0: