Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
We're encountering an issue with
wp-now
's downloading mechanism. Specifically, whenwp-now
downloads WordPress, it stores the files in the/tmp
directory. When attempting to userenameSync
, we're encountering an error. On Linux, it throws anEXDEV: cross-device link not permitted
error, while on Windows it throws anERROR_NOT_SAME_DEVICE
error. This appears to be due to an attempt to move files across different disks or mount points.Why?
The issue arises because both Linux and Windows systems have restrictions regarding moving files across different mount points or drives, respectively. In the case of Linux, the EXDEV error occurs when a program tries to move a file or directory between different filesystems. Similarly, Windows throws the
ERROR_NOT_SAME_DEVICE
error when trying to move a file or directory from one volume to another.How?
This PR solves the issue by modifying the method used to move the downloaded files. Instead of
renameSync
, which fails across different filesystems or disks, it will utilize a different method that can handle cross-filesystem movements. This could involve copying the files to the destination and then deleting the original, or using a different API or library function designed to handle these situations. By doing so, we can ensure thatwp-now
can correctly move downloaded files, even when operating across different filesystems or disks.Testing Instructions
The test is a bit tricky as someone has different disks for different parts of the system.
I guess, but I didn't test it, that the easiest way is to test this on Windows. Given that:
npx nx preview wp-now start --path=<path-with-a-plugin>
and make sure that the directory of the project, is in a different hard drive that the default (other thanC:/