shellingham
Tool to Detect Surrounding Shell
This package has a good security score with no known vulnerabilities.
Community Reviews
Dead simple shell detection that just works, but limited docs
The learning curve is nearly flat because there's so little surface area. You'll be productive in under 5 minutes. However, the documentation is sparse - basically just a README with a quick example. When `detect_shell()` raises `ShellDetectionFailure`, the error message is clear enough, but there's limited guidance on edge cases like nested shells or unusual environments. I found myself reading the source code (which is readable, at least) to understand behavior in SSH sessions.
For what it does, it's solid and maintenance-free in production. The lack of comprehensive docs hasn't been a blocker because the use case is so narrow, but better examples of error handling and edge case behavior would help.
Best for: CLI tools and automation scripts that need basic shell detection without complexity.
Avoid if: You need deep shell environment introspection beyond just identifying the shell name and path.
Lightweight, reliable shell detection with minimal overhead
In production, this library has been rock solid. It adds negligible overhead (single function call, reads process info), has no connection pooling or resource management concerns since it's stateless, and doesn't need logging hooks. Error handling is straightforward with the single exception type. I've used it in CLI tools where we need to generate shell-specific config snippets, and it just works without fuss.
The only gotcha is that it can fail in containerized or restricted environments where /proc access is limited, but the exception makes this clear. No retry logic needed since shell detection is deterministic. Documentation is sparse but the API surface is so small you don't really need it.
Best for: CLI tools and installers that need to generate shell-specific configuration or detect the user's environment.
Avoid if: You need guaranteed results in heavily containerized or sandboxed environments where process inspection may be restricted.
Simple, focused shell detection with minimal overhead
In production, this library has been rock-solid reliable. Error handling is straightforward - it raises `ShellDetectionFailure` when it can't determine the shell, which is easy to catch and handle gracefully. The detection logic works by inspecting parent process information, so it's fast (sub-millisecond) with no I/O blocking. No timeouts to configure, no retry logic needed.
The main limitation is platform support - works great on Linux/macOS via `/proc` or `ps`, and Windows via native APIs, but edge cases exist in containerized environments or unusual process trees. The library hasn't changed much since 1.0, which is actually good - it means the API is stable and you won't hit breaking changes during upgrades.
Best for: CLI tools and developer tooling that need to adapt behavior based on the user's shell environment
Avoid if: You need guaranteed shell detection in all containerized environments or require detailed logging for debugging
Sign in to write a review
Sign In