| 548 | // of failing with EEXIST as POSIX does. "wx" stays as the defense |
| 549 | // against a file appearing between the lstat and the write. |
| 550 | const reportExisting = (stat: Stats | undefined) => { |
| 551 | const detail = |
| 552 | stat?.isSymbolicLink() ? "symlink" |
| 553 | : stat?.isDirectory() ? "directory" |
| 554 | : stat && !stat.isFile() ? "not a regular file" |
| 555 | : "pass --force to overwrite" |
| 556 | stdout(`ark.json already exists at ${settingsPath} (${detail}).\n`) |
| 557 | } |
| 558 | const stat = lstatIfExists(settingsPath) |
| 559 | if (stat) reportExisting(stat) |
| 560 | else { |