Skip to content

Commit

Permalink
Fix "EXDEV: cross-device link not permitted" error (#1174)
Browse files Browse the repository at this point in the history
* Fix "EXDEV: cross-device link not permitted" error

* Fix lint errors

Not sure why standard passes in my dev environment, but hopefully this fixes the CI errors.

* Fix logic mistake

Wow, my bad :/
  • Loading branch information
dizlexik authored and timneutkens committed Feb 16, 2017
1 parent d520838 commit 2e0db62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"loader-utils": "0.2.16",
"minimist": "1.2.0",
"mkdirp-then": "1.2.0",
"mv": "^2.1.1",
"mz": "2.6.0",
"path-match": "1.2.4",
"pkg-up": "1.0.0",
Expand Down
11 changes: 8 additions & 3 deletions server/build/replace.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { rename } from 'mz/fs'
import mv from 'mv'
import { join } from 'path'

export default async function replaceCurrentBuild (dir, buildDir) {
Expand All @@ -7,10 +7,15 @@ export default async function replaceCurrentBuild (dir, buildDir) {
const oldDir = join(buildDir, '.next.old')

try {
await rename(_dir, oldDir)
await move(_dir, oldDir)
} catch (err) {
if (err.code !== 'ENOENT') throw err
}
await rename(_buildDir, _dir)
await move(_buildDir, _dir)
return oldDir
}

function move (from, to) {
return new Promise((resolve, reject) =>
mv(from, to, err => err ? reject(err) : resolve()))
}

0 comments on commit 2e0db62

Please sign in to comment.