[sagenb] 62/179: Don't assume `whoami` exists

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit cbcab980941567cafcf083d93f865c4a47340836
Author: Jeroen Demeyer <jdemeyer at cage.ugent.be>
Date:   Mon Mar 11 04:32:28 2013 -0700

    Don't assume `whoami` exists
    
    Solaris doesn't have a `whoami` command.
---
 sagenb/notebook/sage_email.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sagenb/notebook/sage_email.py b/sagenb/notebook/sage_email.py
index 4204105..dbef470 100644
--- a/sagenb/notebook/sage_email.py
+++ b/sagenb/notebook/sage_email.py
@@ -40,8 +40,9 @@ def default_email_address():
         '... at ...'
     """
     import socket
+    import getpass
     hostname = socket.gethostname()
-    username = os.popen('whoami').read().strip()
+    username = getpass.getuser()
     return '%s@%s'%(username, hostname)
 
 def email(to, subject, body = '', from_address = None, verbose = True, block = False, kill_on_exit = False):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list