Rush StackShopBlogEvents
Skip to main content

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

ParameterTypeDescription
resourceFolderstringThe folder where the lock file will be created
resourceNamestringAn 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.