cmd: A more versatile interface to subprocess for blocking calls