Closed iivmok closed 1 year ago
Do you know the complete command line that it uses to invoke lsof? I haven't been able to reproduce the hang.
Note though that Yori's tools aren't designed to be drop-in replacements for Unix tools and frequently diverge quite a bit. This call is trying to find the process that has a socket open, which is not something Yori's lsof implements.
I think the best I can really do is rename lsof to ylsof and set up aliases. This is something I've done for a lot of commands to avoid the type of thing observed here, although haven't been perfectly consistent for commands which seem unlikely to be ambiguous on a Windows system. As you say, calling lsof on Windows is most likely going to fail with command not found, unless React explicitly provides one; but if it did provide one, the issue is not invoking the one that is provided.
something like lsof -i:1234 -P -t -sTCP:LISTEN
where 1234 would be the port.
To clarify: react-dev-utils handles lsof not existing on windows. It handles two cases well: it not existing, or acting like unix lsof, but in this case its neither, so it doesn't know what to do.
The fix for this (renaming lsof.exe to ylsof.exe) is released as part of Yori 2.0. Please let me know if you encounter further issues.
yori's lsof hangs, and does not follow nix lsof parameters, and so when react-scripts runs lsof it hangs instead of doing anything normal. here's the call: https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/getProcessForPort.js#L28
normally that call fails on windows instead of hanging, which is handled by the library normally