def split_cmdline(s):
    'Perform platform-appropriate command line splitting.\n\n    Identical to `shlex.split()` on non-windows platforms.\n\n    Modified from https://stackoverflow.com/a/35900070\n    '
    if (not on_windows):
        return shlex_split(s)
    RE_CMD_LEX = '"((?:""|\\\\["\\\\]|[^"])*)"?()|(\\\\\\\\(?=\\\\*")|\\\\")|(&&?|\\|\\|?|\\d?>|[<])|([^\\s"&|<>]+)|(\\s+)|(.)'
    args = []
    accu = None
    for (qs, qss, esc, pipe, word, white, fail) in re.findall(RE_CMD_LEX, s):
        if word:
            pass
        elif esc:
            word = esc[1]
        elif (white or pipe):
            if (accu is not None):
                args.append(accu)
            if pipe:
                args.append(pipe)
            accu = None
            continue
        elif fail:
            raise ValueError('invalid or incomplete shell string')
        elif qs:
            word = qs.replace('\\"', '"').replace('\\\\', '\\')
            if (platform == 0):
                word = word.replace('""', '"')
        else:
            word = qss
        accu = ((accu or '') + word)
    if (accu is not None):
        args.append(accu)
    return args
Perform platform-appropriate command line splitting.

Identical to `shlex.split()` on non-windows platforms.

Modified from https://stackoverflow.com/a/35900070
def split_cmdline(s):
    'Perform platform-appropriate command line splitting.\n\n    Identical to `shlex.split()` on non-windows platforms.\n\n    Modified from https://stackoverflow.com/a/35900070\n    '
    if (not on_windows):
        return shlex_split(s)
    RE_CMD_LEX = '"((?:|\\\\["\\\\]|[^"])*)"?()|(\\\\\\\\(?=\\\\*")|\\\\")|(&&?|\\|\\|?|\\d?>|[<])|([^\\s"&|<>]+)|(\\s+)|(.)'
    args = []
    accu = None
    for (qs, qss, esc, pipe, word, white, fail) in re.findall(RE_CMD_LEX, s):
        if word:
            pass
        elif esc:
            word = esc[1]
        elif (white or pipe):
            if (accu is not None):
                args.append(accu)
            if pipe:
                args.append(pipe)
            accu = None
            continue
        elif fail:
            raise ValueError('invalid or incomplete shell string')
        elif qs:
            word = qs.replace('\\"', '"').replace('\\\\', '\\')
            if (platform == 0):
                word = word.replace('', '"')
        else:
            word = qss
        accu = ((accu or ) + word)
    if (accu is not None):
        args.append(accu)
    return args