-
Notifications
You must be signed in to change notification settings - Fork 84
shell
github-actions[bot] edited this page Feb 12, 2026
·
3 revisions
Spawn shell for the bench or execute a command.
Supports multiple input modes:
- Interactive shell (no input)
- Command execution (-c flag)
- Heredoc/piped commands (stdin)
- Passthrough args (-- syntax)
The --bench-console flag provides three modes:
- Interactive: Opens IPython console with Frappe context (no -c or piped input)
- Script: Executes piped Python code (stdin)
- Inline: Executes -c command directly
In interactive mode, provides full terminal support. Exit code from executed commands is preserved.
Usage:
$ fm shell BENCHNAME [OPTIONS]Arguments:
-
BENCHNAME: Name of the bench.
Options:
-
--command: Execute command and exit [default: -c] -
--user: User to connect as -
--service: Service to connect to -
--shell-path: Shell path (e.g., /bin/bash, /bin/sh) -
--run: Use 'docker compose run --rm' -
--bench-console: Open bench console with Frappe context (interactive IPython or execute code via -c/stdin) -
--site: Site name for bench console (defaults to benchname if not specified)
Examples:
Open interactive shell as frappe user
fm shell mybenchOpen shell as root user
fm shell mybench --user rootExecute single command
fm shell mybench -c "bench --version"Execute commands from heredoc
fm shell mybench <<'EOF'
ls -la
bench --version
EOFOpen shell in nginx container
fm shell mybench --service nginx --user nginxRun command with passthrough syntax
fm shell mybench -- bench migrateOpen interactive bench console with IPython
fm shell mybench --bench-consoleOpen bench console for specific site
fm shell mybench --bench-console --site mysite.localhostExecute Python code in Frappe context
fm shell mybench --bench-console -c "import frappe; print(frappe.__version__)"Execute Python script from heredoc in Frappe context
fm shell mybench --bench-console <<'EOF'
import frappe
print(frappe.__version__)
EOFExecute Python script file in Frappe context
fm shell mybench --bench-console < script.py