notahat/tango — pull request #13 by ileitch (2012-02-20 21:25:26+00:00)
Title: Integrate User context and Shell.

Shell commands are executed within the context of the user when inside the scope of `as_user`.

I tried the approach of keeping open a persistent shell and writing/reading through pipes, though it turned out to be more complex than I'd like. Specifically there's no way to get the return status of a command without restoring to hacks.

The approach implemented here simply uses a new login shell for each command. Slower, but not enough to be any concern.

The Directory and Umask contexts are also carried over into the new shell.