opticdev / optic

OpenAPI linting, diffing and testing. Optic helps prevent breaking changes, publish accurate documentation and improve the design of your APIs.
https://useoptic.com
MIT License
1.35k stars 79 forks source link

fix(optic): don't loop forever when running from `/` #2751

Closed notnmeyer closed 6 months ago

notnmeyer commented 6 months ago

🍗 Description

What does this PR do? Anything folks should know?

i noticed what i thought was an issue with our docker image, where any invocation of optic would hang without output and require a kill -9 to stop. after some stracing and validating where it first sprung up i narrowed it down to the seemingly innocuous way we walk the file tree to find a config.

when $PWD is / the walk enters an infinite loop. this most noticeable in the image because we leave its WORKDIR set at the root, /. you can however replicate this on macOS as well with,

cd / && optic --version

just be ready to grab the pid so you can kill it :)

📚 References

Links to relevant docs (Notion, Twist, GH issues, etc.), if applicable.

👹 QA

How can other humans verify that this PR is correct?