Home > @rushstack/node-core-library > LockFile > tryAcquire
LockFile.tryAcquire() method
Attempts to create a lockfile with the given filePath.
Signature:
static tryAcquire(resourceFolder: string, resourceName: string): LockFile | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
resourceFolder | string | The folder where the lock file will be created |
resourceName | string | An alphanumeric name that describes the resource being locked. This will become the filename of the temporary file created to manage the lock. |
Returns:
LockFile | undefined
If successful, returns a LockFile
instance. If unable to get a lock, returns undefined
.