Skip to content

Commit 8ff09a8

Browse files
committed
Switch statSync to lstatSync
1 parent 90d601e commit 8ff09a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/php-wasm/xdebug-bridge/src/start-bridge.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { PHP } from '@php-wasm/universal';
2-
import { readdirSync, readFileSync, statSync } from 'fs';
2+
import { readdirSync, readFileSync, lstatSync } from 'fs';
33
import { join } from 'path';
44
import { CDPServer } from './cdp/cdp-server';
55
import { XdebugCDPBridge } from './cdp/xdebug-cdp-bridge';
@@ -46,7 +46,8 @@ export async function startBridge(config: StartBridgeConfig) {
4646
const list = readdirSync(dir);
4747
for (const file of list) {
4848
const filePath = join(dir, file);
49-
const stat = statSync(filePath);
49+
// lstat avoids crashes when encountering symlinks
50+
const stat = lstatSync(filePath);
5051
if (stat && stat.isDirectory()) {
5152
results.push(...getPhpFiles(filePath));
5253
} else if (file.endsWith('.php')) {

0 commit comments

Comments
 (0)