Centralisation du remplacement de os.getlogin

On utilise la variable SUDO_USER et sinon on se rabat sur un getuid

darcs-hash:20040910192447-41617-51511e6987093eae4473592bde71fa0bd73f0151.gz
This commit is contained in:
pauget 2004-09-10 21:24:47 +02:00
parent 3d34d11860
commit e0da11ea79
4 changed files with 19 additions and 21 deletions

View file

@ -7,7 +7,7 @@ Copyright (C) Fr
Licence : GPLv2
"""
import os,string,time,sys,pwd, affich_tools
import os,string,time,sys, affich_tools
def make_lock(lock_name, lock_comment='') :
""" Création d'un lock """
@ -35,7 +35,7 @@ def make_lock(lock_name, lock_comment='') :
### Prise du lock
lock_fd=open(lock_file, "w")
lock_fd.write("%s\n%s\n%s" % (os.getpid(), pwd.getpwuid(os.getuid())[0], lock_comment) )
lock_fd.write("%s\n%s" % (os.getpid(), lock_comment) )
lock_fd.close()
def remove_lock( lock_name ) :