(self, lockfile, *cmd_list)
return subprocess.call(cmd_list)
Emulates the most basic behavior of Linux's flock(1).
Emulates the most basic behavior of Linux's flock(1).
Emulates the most basic behavior of Linux s flock ( 1 ) .
def ExecFlock(self, lockfile, *cmd_list):
    """Emulates the most basic behavior of Linux's flock(1)."""
    # Rely on exception handling to report errors.
    # Note that the stock python on SunOS has a bug
    # where fcntl.flock(fd, LOCK_EX) always fails
    # with EBADF, that's why we use this F_SETLK
    # hack instead.
    fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
    op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
    fcntl.fcntl(fd, fcntl.F_SETLK, op)
    return subprocess.call(cmd_list)
def ExecFlock ( self , lockfile , * cmd_list ) : # Rely on exception handling to report errors. # Note that the stock python on SunOS has a bug # where fcntl.flock(fd, LOCK_EX) always fails # with EBADF, that's why we use this F_SETLK # hack instead. fd = os . open ( lockfile , os . O_WRONLY | os . O_NOCTTY | os . O_CREAT , 0666 ) op = struct . pack ( 'hhllhhl' , fcntl . F_WRLCK , 0 , 0 , 0 , 0 , 0 , 0 ) fcntl . fcntl ( fd , fcntl . F_SETLK , op ) return subprocess . call ( cmd_list )