Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a cross-device mv error by using a tmp directory inside document …
…root (#886) Solves the [error discovered by @sejas](WordPress/playground-tools#116 (comment)) caused by calling `php.mv(fromPath, toPath)` when `fromPath` is a mounted local directory and `toPath` is a MEMFS directory. Emscripten doesn't support such a scenario: ``` Proceeding without the Notification plugin. Could not install it in wp-admin. The original error was: Error: Could not move "/tmp/assets/Notification/notification": Cross-device link. Error: Could not move "/tmp/assets/Notification/notification": Cross-device link. at descriptor.value (/playground-tools/node_modules/@php-wasm/node/index.cjs:67481:17) ``` The solution proposed in this PR replaces a `/tmp` directory with a randomly-named temporary directory inside `wp-content`. `/tmp` doesn't necessarily point to a system temp directory and needs to be revisited anyway. Whether we should use a temporary directory inside `wp-content` is another matter, but that part may be revisited once the [recursive cp](#846) feature is added.
- Loading branch information