Skip to content

Commit 8a8f7b3

Browse files
authored
flock npm.add (#20557)
1 parent c526caa commit 8a8f7b3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

packages/opencode/src/npm/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import semver from "semver"
22
import z from "zod"
33
import { NamedError } from "@opencode-ai/util/error"
44
import { Global } from "../global"
5-
import { Lock } from "../util/lock"
65
import { Log } from "../util/log"
76
import path from "path"
87
import { readdir, rm } from "fs/promises"
@@ -57,11 +56,11 @@ export namespace Npm {
5756
}
5857

5958
export async function add(pkg: string) {
60-
using _ = await Lock.write(`npm-install:${pkg}`)
59+
const dir = directory(pkg)
60+
await using _ = await Flock.acquire(`npm-install:${Filesystem.resolve(dir)}`)
6161
log.info("installing package", {
6262
pkg,
6363
})
64-
const dir = directory(pkg)
6564

6665
const arborist = new Arborist({
6766
path: dir,

0 commit comments

Comments
 (0)