Skip to content

Commit af6e674

Browse files
committed
Create mount point directories before mounting in php-cli-worker
The php.mount() call requires the mount point directory to already exist in the PHP VFS. In the spawned PHP CLI workers, we need to create these directories (/tmp, /wordpress, /home) before mounting native directories to them. This was already done in worker-thread-v2.ts but the shared mountResources() function in mounts.ts didn't create directories, causing spawned PHP workers to fail when trying to mount native directories in CI (Ubuntu).
1 parent ad9aa31 commit af6e674

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/playground/cli/src/mounts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export function parseMountDirArguments(mounts: string[]): Mount[] {
7676

7777
export async function mountResources(php: PHP, mounts: Mount[]) {
7878
for (const mount of mounts) {
79+
// Create the mount point directory if it doesn't exist.
80+
// This is necessary because php.mount() requires the directory to exist.
81+
if (!php.isDir(mount.vfsPath)) {
82+
php.mkdir(mount.vfsPath);
83+
}
7984
await php.mount(
8085
mount.vfsPath,
8186
createNodeFsMountHandler(mount.hostPath)

0 commit comments

Comments
 (0)