diff --git a/@xen-orchestra/fs/src/abstract.js b/@xen-orchestra/fs/src/abstract.js index 2df1c4a51..540ceb59e 100644 --- a/@xen-orchestra/fs/src/abstract.js +++ b/@xen-orchestra/fs/src/abstract.js @@ -18,6 +18,7 @@ import { createChecksumStream, validChecksumOfReadStream } from './checksum' const { dirname } = path.posix type Data = Buffer | Readable | string +type Disposable = {| dispose: () => void | Promise, value?: T |} type FileDescriptor = {| fd: mixed, path: string |} type LaxReadable = Readable & Object type LaxWritable = Writable & Object @@ -259,9 +260,9 @@ export default class RemoteHandlerAbstract { return entries } - lock(path: string): Promise { + async lock(path: string): Promise { path = normalizePath(path) - return this._lock(path) + return { dispose: await this._lock(path) } } async mkdir(dir: string, { mode }: { mode?: number } = {}): Promise {