def str2cmd()

in pystemd/utils.py [0:0]


def str2cmd(cmd, cont=False):
    """
    coverts a string (or bytes) into a cmd list usable by the Exec* family of Unit Signatures, you could do


    pystemd.run(
        cmd=...,
        extra={
            b"ExecReload": [str2cmd("/bin/echo 'there is no reaload'")]
        },
    )

    The cont param is for ignore failure and continue

    """
    cmd = x2char_star(cmd).decode()
    cmdlist = tuple(x2char_star(_) for _ in shlex.split(cmd))

    return (cmdlist[0], cmdlist, cont)