import logging
import re
import subprocess

log = logging.getLogger(__name__)


def run(cmd, check=True, cap=False, input=None, exe='/bin/bash', cwd=None, env=None):
    log.debug(f"Executing: {cmd!r}")
    shell = isinstance(cmd, str)
    result = subprocess.run(
        cmd,
        check=check,
        shell=shell,
        capture_output=cap,
        executable=exe if shell else None,
        input=input.encode() if input else None,
        cwd=cwd,
        env=env,
    )

    if cap:
        return result.stdout.decode()
    else:
        return result


def partition(pred, list):
    trues, falses = [], []
    for item in list:
        (trues if pred(item) else falses).append(item)
    return trues, falses


def partition_by_regex(regex, list):
    r = re.compile(regex or '')
    return partition(r.search, list)

import logging
import re
import subprocess

log = logging.getLogger(__name__)


def run(cmd, check=True, cap=False, input=None, exe='/bin/bash', cwd=None, env=None):
    log.debug(f"Executing: {cmd!r}")
    shell = isinstance(cmd, str)
    result = subprocess.run(
        cmd,
        check=check,
        shell=shell,
        stdout=subprocess.PIPE if cap in (True, 'stdout') else None,
        stderr=subprocess.PIPE if cap in (True, 'stderr') else None,
        executable=exe if shell else None,
        input=input.encode() if input else None,
        cwd=cwd,
        env=env,
    )

    if cap:
        return result.stdout.decode()
    else:
        return result


def partition(pred, list):
    trues, falses = [], []
    for item in list:
        (trues if pred(item) else falses).append(item)
    return trues, falses


def partition_by_regex(regex, list):
    r = re.compile(regex or '')
    return partition(r.search, list)

Change 'cap' in 'run' to accept True, 'stdout', or 'stderr'
Change 'cap' in 'run' to accept True, 'stdout', or 'stderr'

In 2e6873e I made cap=True equivalent to the new 'capture_output'.
This was a mistake. Turns out fzf writes its UI to stderr (makes sense),
so that was suppressed. Now you can be specific about what to capture.
