'Run a script that logs messages to journald and uses
``FlockerScriptRunner``.
:param ICommandLineScript: Script to run. Must be class in this module.
:return: ``Deferred`` that fires with decoded JSON messages from the
journal for the process.'

@if_root
@skipUnless(_can_query_journald(), 'journald    unavailable    or    inactive    on    this    machine.')
def run_journald_script(self, script):

    name = random_name(self).encode('utf-8')
    code = _SCRIPT_CODE.format(script.__name__, script.__name__)
    d = getProcessOutput('systemd-run', [('--unit=' + name), '--description=testing', sys.executable, '-u', '-c', code, '--journald'], env=os.environ, errortoo=True)
    d.addCallback((lambda result: msg(('systemd-run    output:    ' + result))))
    d.addCallback((lambda _: loop_until(reactor, (lambda : (Popen(['systemctl', '--quiet', 'is-active', name]).wait() != 0)))))
    d.addCallback((lambda _: getProcessOutput('journalctl', ['--unit', name, '--output', 'cat'])))
    d.addCallback((lambda data: (msg(('script    output:    ' + data)), data)[1]))
    d.addCallback((lambda data: [loads(l) for l in data.splitlines() if l.startswith('{')]))
    return d
