Tool to Detect Surrounding Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
news
src/shellingham
tasks
tests Add test based on pypa/pipenv#2496 Jul 4, 2018
.gitignore
CHANGELOG.rst
LICENSE Init Jun 14, 2018
MANIFEST.in
Pipfile
Pipfile.lock
README.rst
pyproject.toml
setup.cfg Safe to say we're in alpha now Jul 10, 2018
setup.py Improve version parsing Jun 19, 2018

README.rst

Shellingham: Tool to Detect Surrounding Shell

Shellingham detects what shell the current Python executable is running in.

Usage

>>> import shellingham
>>> shellingham.detect_shell()
('bash', '/bin/bash')

detect_shell pokes around the process's running environment to determine what shell it is run in. It returns a 2-tuple:

  • The shell name, always lowercased.
  • The command used to run the shell.

ShellDetectionFailure is raised if detect_shell fails to detect the surrounding shell.

Notes

  • The shell name is always lowercased.
  • On Windows, the shell name is the name of the executable, minus the file exetension.
  • Currently the command only contains the executable name on Windows, even if the command is invoked by the full path. This may change in the future.