Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: EXDEV: cross-device link not permitted #260

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"env-string": "^1.0.0",
"escape-string-regexp": "^4.0.0",
"execspawn": "^1.0.1",
"fs-extra": "^10.1.0",
"has-unicode": "^2.0.1",
"hsl-to-rgb-for-reals": "^1.1.0",
"jsonstream2": "^3.0.0",
Expand Down
11 changes: 5 additions & 6 deletions platform/v8.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const fs = require('fs')
const fs = require('fs-extra')
const path = require('path')
const { spawn } = require('child_process')
const pump = require('pump')
Expand All @@ -9,7 +9,6 @@ const through = require('through2')
const debug = require('debug')('0x')
const v8LogToTicks = require('../lib/v8-log-to-ticks')
const { promisify } = require('util')
const rename = promisify(fs.rename)
const sleep = promisify(setTimeout)

const {
Expand Down Expand Up @@ -124,7 +123,7 @@ async function v8 (args) {
if (!isolateLog) throw Error('no isolate logfile found')

const isolateLogPath = path.join(folder, isolateLog)
await renameSafe(path.join(args.workingDir, isolateLog), isolateLogPath)
await moveSafe(path.join(args.workingDir, isolateLog), isolateLogPath)
return {
ticks: await v8LogToTicks(isolateLogPath, { pathToNodeBinary, collectDelay }),
inlined: inlined,
Expand All @@ -139,15 +138,15 @@ v8.getIsolateLog = function (workingDir, pid) {
return fs.readdirSync(workingDir).find(regex.test.bind(regex))
}

async function renameSafe (from, to, tries = 0) {
async function moveSafe (from, to, tries = 0) {
try {
await rename(from, to)
await fs.move(from, to)
} catch (e) {
if (tries > 5) {
throw e
}
await sleep(1000)
await renameSafe(from, to, tries++)
await moveSafe(from, to, tries + 1)
}
}

Expand Down