path: root/scripts/contrib
diff options
authorMarkus Lehtonen <>2017-04-12 22:17:32 +0300
committerRichard Purdie <>2017-04-12 23:55:53 +0100
commit66b7f495bb000c043ae24176dcdec0cb087eeecf (patch)
tree47e109187f58019b94e3644d1a6bdf968af1c90f /scripts/contrib
parent0c9b981e88c76da316e76f17e6da3a03b87c5008 (diff)
openembedded-core-66b7f495bb000c043ae24176dcdec0cb087eeecf.tar.bz2 use pwd for getting user name
Use pwd data instead of os.getlogin() to get the username for fallback email address. os.getlogin() basically returns the name of the user logged in on the controlling terminal of the process and raises an exception on some systems if the process does not have a controlling terminal - when executed from a cron script, for example. Signed-off-by: Markus Lehtonen <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'scripts/contrib')
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/contrib/ b/scripts/contrib/
index 055a7b12cf..261ca514e5 100755
--- a/scripts/contrib/
+++ b/scripts/contrib/
@@ -211,9 +211,10 @@ def send_email(text_fn, html_fn, subject, recipients):
raise ReportError("Neither plain text nor html body specified")
- full_name = pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
+ pw_data = pwd.getpwuid(os.getuid())
+ full_name = pw_data.pw_gecos.split(',')[0]
email = os.environ.get('EMAIL',
- '{}@{}'.format(os.getlogin(), socket.getfqdn()))
+ '{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
msg['From'] = "{} <{}>".format(full_name, email)
msg['To'] = ', '.join(recipients)
msg['Subject'] = subject