Home > @rushstack/node-core-library > LockFile > tryAcquire

LockFile.tryAcquire() method

Attempts to create a lockfile with the given filePath. If successful, returns a LockFile instance. If unable to get a lock, returns undefined.


static tryAcquire(resourceDir: string, resourceName: string): LockFile | undefined;


Parameter Type Description
resourceDir string  
resourceName string the name of the resource we are locking on. Should be an alphabetic string.


LockFile | undefined