From 0383e8729d447f6f5f225f2e8317f65bb9eb6a22 Mon Sep 17 00:00:00 2001 From: Dan Lipsitt Date: Tue, 5 May 2015 11:32:10 -0700 Subject: [PATCH] Use python date format code instead of shelling out. --- stdeb/util.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/stdeb/util.py b/stdeb/util.py index c7321131..14e09376 100644 --- a/stdeb/util.py +++ b/stdeb/util.py @@ -13,6 +13,7 @@ import tempfile import stdeb from stdeb import log, __version__ as __stdeb_version__ +from email.utils import formatdate if hasattr(os,'link'): link_func = os.link @@ -256,12 +257,8 @@ def normstr(s): return result def get_date_822(): - """return output of 822-date command""" - cmd = '/bin/date' - if not os.path.exists(cmd): - raise ValueError('%s command does not exist.'%cmd) - args = [cmd,'-R'] - result = get_cmd_stdout(args).strip() + """return date string in rfc 822 format""" + result = formatdate() result = normstr(result) return result