INNER CODE UNIT · Python

run_command

PKU-EMBL/BASALT · BASALT_setup_China_mainland.py:76

def run_command(
    command: Sequence[str],
    cwd: Optional[Path] = None,
    env: Optional[Dict[str, str]] = None,
    dry_run: bool = False,
    capture: bool = False,
) -> subprocess.CompletedProcess:
    """Run a command safely, or print it in dry-run mode."""
    location = " (in {})".format(cwd) if cwd else ""
    print("+ {}{}".format(quote_command(command), location))
    if dry_run:
        return subprocess.CompletedProcess(command, 0, stdout="", stderr="")
    try:
        return subprocess.run(
            [str(item) for item in command],
            cwd=str(cwd) if cwd else None,
            env=env,
            check=True,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…