Run ``command`` in a ``sudo`` subprocess and return a `.Result` object. See `.Context.sudo` for API details, such as the ``password`` kwarg. .. note:: This function is a convenience wrapper around Invoke's `.Context` and `.Runner` APIs. Specifically, it create
(command: str, **kwargs: Any)
| 53 | |
| 54 | |
| 55 | def sudo(command: str, **kwargs: Any) -> Result: |
| 56 | """ |
| 57 | Run ``command`` in a ``sudo`` subprocess and return a `.Result` object. |
| 58 | |
| 59 | See `.Context.sudo` for API details, such as the ``password`` kwarg. |
| 60 | |
| 61 | .. note:: |
| 62 | This function is a convenience wrapper around Invoke's `.Context` and |
| 63 | `.Runner` APIs. |
| 64 | |
| 65 | Specifically, it creates an anonymous `.Context` instance and calls its |
| 66 | `~.Context.sudo` method, which in turn defaults to using a `.Local` |
| 67 | runner subclass for command execution (plus sudo-related bits & |
| 68 | pieces). |
| 69 | |
| 70 | .. versionadded:: 1.4 |
| 71 | """ |
| 72 | return Context().sudo(command, **kwargs) |