mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(fs): tolerate EACCES on existing mkdir targets (#319)
Add mkdirSafe/mkdirSyncSafe helpers that swallow EACCES/EPERM when the target directory already exists with execute permission, and route all recursive mkdir call sites through them so pre-existing directories owned by another user do not break backend startup, file ops, or repo mirroring.
This commit is contained in:
1 parent
8a8bdc18b0
commit
87f3d7f230
22 files changed
+210
-46
No files matched your search
@@ -8,6 +8,7 @@ import { getWorkspacePath } from '@opencode-manager/shared/config/env'
|
||||
import { broadcastSSHHostKeyRequest } from '../services/sse-aggregator'
|
||||
import { executeCommand } from '../utils/process'
|
||||
import { parseSSHHost, normalizeHostPort } from '../utils/ssh-key-manager'
|
||||
import { mkdirSafe } from '../utils/fs-safe'
|
||||
|
||||
interface SSHHostKeyRequest {
|
||||
id: string
|
||||
@@ -40,7 +41,7 @@ export class SSHHostKeyHandler implements IPCHandler {
|
||||
private async ensureKnownHostsFile(): Promise<void> {
|
||||
try {
|
||||
const configDir = path.join(getWorkspacePath(), 'config')
|
||||
await fs.mkdir(configDir, { recursive: true })
|
||||
await mkdirSafe(configDir)
|
||||
try {
|
||||
await fs.access(this.knownHostsPath)
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user