Skip to content


String substitution for user parameter #1

wants to merge 1 commit into from

1 participant


I thought this may be useful as sometimes you don't want to hardcode the user parameter for sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 2 additions and 0 deletions.
  1. +2 −0 fabric/
2 fabric/
@@ -658,6 +658,8 @@ def _run_command(
format = env.format
if format:
command = command.format(**env)
+ if sudo and user:
+ user = user.format(**env)
# Set up new var so original argument can be displayed verbatim later.
given_command = command
# Handle context manager modifications, and shell wrapping
Something went wrong with that request. Please try again.