Thanks. I thought I was running into some weird bash default, but as you implied there was a `who` deep in a rat's nest of sourced .bashrc files.
On 12/18/2012 03:31 PM, Jeff Forcier wrote: > Chopping out the offending text is certainly one option, but it's more > addressing the symptom; I'd guess the root cause is something in > Chris' shell login files (or the global ones they may source) calling > 'who' or whatnot. > > If that is the case then you'd have to figure out which is more > important, having that run when you log in by hand, or having clean > output when scripting SSH connections to the server (as w/ Fabric). > You could also try setting env.use_shell = False to disable the shell > wrapper, which would then skip those login files (at the cost of > possibly losing some shell niceties for more complex commands). > > Best, > Jeff > > > On Tue, Dec 18, 2012 at 12:00 PM, 686f6c6d <686f6...@googlemail.com> wrote: >> (Sorry, forgot to reply to the list, too.) >> >> >> I also can't tell you how those strings appear, but you can easily >> work around it; you can do something like the following, for example. >> If replace() or sub() don't find a match (when no other users are >> logged in), the string remains unchanged. >> >> ---------- 8< ---------- >> import re >> >> foo = run('some command') >> print('debug #1: %s' % foo) >> >> foo = foo.replace('Other users are logged in\n','') >> print('debug #2: %s' % foo) >> >> foo = >> re.sub(r'[a-z]+\s+pts/\d+\s+\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{2}\s+\(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\)\n','',foo) >> print('debug #3: %s' % foo) >> ---------- >8 ---------- >> >> The regex is a bit coarse (as are my python skills), but it should work. >> >> >> -- >> Kind regards >> Christopher 'm4z' Holm / 686f6c6d >> >> "We must respect the other fellow's religion, but only in the sense >> and to the extent that we respect his theory that his wife is >> beautiful and his children smart." --H. L. Mencken >> >> _______________________________________________ >> Fab-user mailing list >> Fab-user@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/fab-user > > > _______________________________________________ Fab-user mailing list Fab-user@nongnu.org https://lists.nongnu.org/mailman/listinfo/fab-user