{"id":31537697,"url":"https://github.com/hansalemaos/cmdbashinteractive","last_synced_at":"2026-04-18T03:32:50.142Z","repository":{"id":205394352,"uuid":"714151183","full_name":"hansalemaos/cmdbashinteractive","owner":"hansalemaos","description":"Interact with subprocesses running both bash.exe (CygWin) and cmd.exe without terminating them.","archived":false,"fork":false,"pushed_at":"2023-11-04T03:54:44.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-05T16:40:21.622Z","etag":null,"topics":["bash","cmd","cygwin","sh","subprocess"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cmdbashinteractive","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hansalemaos.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-04T03:54:21.000Z","updated_at":"2024-05-26T21:20:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b652690-d429-4d26-af60-4ed3e5fb387f","html_url":"https://github.com/hansalemaos/cmdbashinteractive","commit_stats":null,"previous_names":["hansalemaos/cmdbashinteractive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hansalemaos/cmdbashinteractive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansalemaos%2Fcmdbashinteractive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansalemaos%2Fcmdbashinteractive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansalemaos%2Fcmdbashinteractive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansalemaos%2Fcmdbashinteractive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hansalemaos","download_url":"https://codeload.github.com/hansalemaos/cmdbashinteractive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansalemaos%2Fcmdbashinteractive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31955719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cmd","cygwin","sh","subprocess"],"created_at":"2025-10-04T08:10:09.344Z","updated_at":"2026-04-18T03:32:50.133Z","avatar_url":"https://github.com/hansalemaos.png","language":"Python","readme":"# Interact with subprocesses running both bash.exe (CygWin) and cmd.exe without terminating them.\r\n\r\n## pip install cmdbashinteractive\r\n\r\n```python\r\n\r\n\r\nArgs:\r\n\tprint_stdout (bool, optional): Whether to print stdout from the subprocess (default is True).\r\n\tprint_stderr (bool, optional): Whether to print stderr from the subprocess (default is True).\r\n\tlimit_stdout (int, optional): Maximum number of lines to keep in stdout history (default is None).\r\n\tlimit_stderr (int, optional): Maximum number of lines to keep in stderr history (default is None).\r\n\tlimit_stdin (int, optional): Maximum number of lines to keep in stdin history (default is None).\r\n\tconvert_to_83 (bool, optional): Whether to convert file paths to short (8.3) format (default is True).\r\n\texitcommand (str, optional): The command to signal the subprocess to exit (default is \"▓▓▓▓▓▓▓▓▓▓▓\").\r\n\tnewline (str, optional): The newline character to use (default is \"\\n\").\r\n\tgetcomspec (str, optional): The command to get the shell executable (default is \"bash.exe\").\r\n\twait_to_complete (float, optional): The time to wait for subprocess completion (default is 0.1 seconds).\r\n\t**kwargs: Additional keyword arguments for subprocess.Popen.\r\n\r\nimport os\r\n\r\nfrom cmdbashinteractive import BashInteractive, CmdInteractive\r\n\r\nCREATE_NEW_PROCESS_GROUP = 0x00000200\r\nDETACHED_PROCESS = 0x00000008\r\n\r\n\r\nsh = BashInteractive(\r\n    print_stdout=True,\r\n    print_stderr=True,\r\n    limit_stdout=None,\r\n    limit_stderr=None,\r\n    limit_stdin=None,\r\n    convert_to_83=True,\r\n    exitcommand=\"▓▓▓▓▓▓▓▓▓▓▓\",\r\n    newline=\"\\n\",\r\n    getcomspec=r\"C:\\cygwin\\bin\\bash.exe\",\r\n    wait_to_complete=0.1,\r\n    shell=False,  # **kwargs\r\n    creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP,  # **kwargs\r\n    bufsize=0,  # **kwargs\r\n    env=os.environ.copy(),  # **kwargs\r\n)\r\nstdo00, stde00 = sh(\"ls\")\r\nsh.install(\"tar\")\r\nstdo01, stde01 = sh(\"ping google.com | grep bytes\")\r\nstdo02, stde02 = sh(\r\n    r\"cat C:\\yolov5max - Copy\\2023_08_17.ini\"\r\n)  # automatically converted to 8.3 and afterwards to cygwin  when convert_to_83 is True\r\n```\r\n\r\n\r\n```python\r\nArgs:\r\n\tprint_stdout (bool, optional): Whether to print stdout from the subprocess (default is True).\r\n\tprint_stderr (bool, optional): Whether to print stderr from the subprocess (default is True).\r\n\tlimit_stdout (int, optional): Maximum number of lines to keep in stdout history (default is None).\r\n\tlimit_stderr (int, optional): Maximum number of lines to keep in stderr history (default is None).\r\n\tlimit_stdin (int, optional): Maximum number of lines to keep in stdin history (default is None).\r\n\tconvert_to_83 (bool, optional): Whether to convert file paths to short (8.3) format (default is True).\r\n\texitcommand (str, optional): The command to signal the subprocess to exit (default is \"▓▓▓▓▓▓▓▓▓▓▓\").\r\n\tgetcomspec (str, optional): The command to get the shell executable (default is None).\r\n\tnewline (str, optional): The newline character to use (default is \"\\r\\n\").\r\n\twait_to_complete (float, optional): The interval to check for subprocess completion (default is 0.1 seconds).\r\n\t**kwargs: Additional keyword arguments for subprocess.Popen.\r\n\r\n\r\ncmd = CmdInteractive(\r\n    print_stdout=True,\r\n    print_stderr=True,\r\n    limit_stdout=10,\r\n    limit_stderr=10,\r\n    limit_stdin=10,\r\n    convert_to_83=True,\r\n    exitcommand=\"▓▓▓▓▓▓▓▓▓▓▓\",\r\n    wait_to_complete=0.1,\r\n    shell=False,  # **kwargs\r\n    creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP,  # **kwargs\r\n    bufsize=0,  # **kwargs\r\n    env=os.environ.copy(),  # **kwargs\r\n    getcomspec=None,\r\n    newline=\"\\r\\n\",\r\n)\r\n#\r\nstrfi = sh(\r\n    r\"strings C:\\yolov5max - Copy\\2023_08_17.ini\"\r\n)  # automatically converted to 8.3 when convert_to_83 is True\r\n\r\nstdo0, stde0 = cmd(f\"ping google.com\", wait_to_complete=0.1)\r\nstdo1, stde1 = cmd(f\"dir\", wait_to_complete=0.1)\r\nstdo2, stde2 = cmd(f\"whoami.exe\", wait_to_complete=0.1)\r\nstdo3, stde3 = cmd(\r\n    f\"ping google.com\", wait_to_complete=0\r\n)  # non blocking, not recommended - might mess up stdout,stderr\r\nstdo4, stde4 = cmd(\r\n    f\"dir\", wait_to_complete=0\r\n)  # non blocking, not recommended - might mess up stdout,stderr\r\nstdo5, stde5 = cmd(\r\n    f\"whoami.exe\", wait_to_complete=0\r\n)  # non blocking, not recommended - might mess up stdout,stderr\r\n\r\n\r\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansalemaos%2Fcmdbashinteractive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhansalemaos%2Fcmdbashinteractive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansalemaos%2Fcmdbashinteractive/lists"}