{"id":19703287,"url":"https://github.com/intelorca/winpty.net","last_synced_at":"2025-07-31T14:17:07.051Z","repository":{"id":144136094,"uuid":"88527627","full_name":"IntelOrca/winpty.NET","owner":"IntelOrca","description":".NET wrapper for winpty","archived":false,"fork":false,"pushed_at":"2017-04-17T18:30:38.000Z","size":14,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T14:34:27.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/IntelOrca.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}},"created_at":"2017-04-17T16:30:56.000Z","updated_at":"2025-03-29T04:01:06.000Z","dependencies_parsed_at":"2023-05-19T18:15:17.052Z","dependency_job_id":null,"html_url":"https://github.com/IntelOrca/winpty.NET","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/IntelOrca/winpty.NET","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelOrca%2Fwinpty.NET","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelOrca%2Fwinpty.NET/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelOrca%2Fwinpty.NET/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelOrca%2Fwinpty.NET/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntelOrca","download_url":"https://codeload.github.com/IntelOrca/winpty.NET/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelOrca%2Fwinpty.NET/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268054482,"owners_count":24188224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2024-11-11T21:17:28.196Z","updated_at":"2025-07-31T14:17:07.034Z","avatar_url":"https://github.com/IntelOrca.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# winpty.NET\nA .NET wrapper for [winpty](https://github.com/rprichard/winpty).\n\n## Build Status\n|             | AppVeyor | NuGet |\n|-------------|----------|-------|\n| **master**  | [![AppVeyor](https://ci.appveyor.com/api/projects/status/g0m338d3u33o9gox/branch/master?svg=true)](https://ci.appveyor.com/project/IntelOrca/winpty-net) | [![NuGet Status](https://img.shields.io/nuget/v/winpty.NET.svg?style=flat)](https://www.nuget.org/packages/winpty.NET/) |\n\n## NuGet\n\n    PM\u003e Install-Package winpty.NET\n\n## Example\n```csharp\nusing System;\nusing System.IO;\nusing System.IO.Pipes;\nusing static winpty.WinPty;\n\nclass WinPtyExample\n{\n    static int Main(string[] args)\n    {\n        IntPtr handle = IntPtr.Zero;\n        IntPtr err = IntPtr.Zero;\n        IntPtr cfg = IntPtr.Zero;\n        IntPtr spawnCfg = IntPtr.Zero;\n        Stream stdin = null;\n        Stream stdout = null;\n        try\n        {\n            cfg = winpty_config_new(WINPTY_FLAG_COLOR_ESCAPES, out err);\n            winpty_config_set_initial_size(cfg, 80, 32);\n\n            handle = winpty_open(cfg, out err);\n            if (err != IntPtr.Zero)\n            {\n                Console.WriteLine(winpty_error_code(err));\n                return 1;\n            }\n\n            string exe = @\"C:\\Windows\\System32\\cmd.exe\";\n            string args = \"\";\n            string cwd = @\"C:\\\";\n            spawnCfg = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, exe, args, cwd, null, out err);\n            if (err != IntPtr.Zero)\n            {\n                Console.WriteLine(winpty_error_code(err));\n                return 1;\n            }\n\n            stdin = CreatePipe(winpty_conin_name(handle), PipeDirection.Out);\n            stdout = CreatePipe(winpty_conout_name(handle), PipeDirection.In);\n\n            if (!winpty_spawn(handle, spawnCfg, out IntPtr process, out IntPtr thread, out int procError, out err))\n            {\n                Console.WriteLine(winpty_error_code(err));\n                return 1;\n            }\n\n            // Play with tty streams stdin and stdout...\n\n            return 0;\n        }\n        finally\n        {\n            stdin?.Dispose();\n            stdout?.Dispose();\n            winpty_config_free(cfg);\n            winpty_spawn_config_free(spawnCfg);\n            winpty_error_free(err);\n            winpty_free(handle);\n        }\n    }\n\n    private Stream CreatePipe(string pipeName, PipeDirection direction)\n    {\n        string serverName = \".\";\n        if (pipeName.StartsWith(\"\\\\\"))\n        {\n            int slash3 = pipeName.IndexOf('\\\\', 2);\n            if (slash3 != -1)\n            {\n                serverName = pipeName.Substring(2, slash3 - 2);\n            }\n            int slash4 = pipeName.IndexOf('\\\\', slash3 + 1);\n            if (slash4 != -1)\n            {\n                pipeName = pipeName.Substring(slash4 + 1);\n            }\n        }\n\n        var pipe = new NamedPipeClientStream(serverName, pipeName, direction);\n        pipe.Connect();\n        return pipe;\n    }\n}\n```\n\n## Copyright\nwinpty.NET and winpty are both distributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelorca%2Fwinpty.net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintelorca%2Fwinpty.net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelorca%2Fwinpty.net/lists"}