Title: Tests using Cobra with `ptytest` can hang on macOS (and Windows) unless the output is consumed · Issue #2122 · coder/coder · GitHub
Open Graph Title: Tests using Cobra with `ptytest` can hang on macOS (and Windows) unless the output is consumed · Issue #2122 · coder/coder
X Title: Tests using Cobra with `ptytest` can hang on macOS (and Windows) unless the output is consumed · Issue #2122 · coder/coder
Description: Unless ptytest output is consumed, a test can hang if a command outputs more than 1024 bytes (at least on macOS). There are two ways to work around this issue: Consume the output via pty.ExpectMatch() (ensure no more than 1024 bytes are ...
Open Graph Description: Unless ptytest output is consumed, a test can hang if a command outputs more than 1024 bytes (at least on macOS). There are two ways to work around this issue: Consume the output via pty.ExpectMatc...
X Description: Unless ptytest output is consumed, a test can hang if a command outputs more than 1024 bytes (at least on macOS). There are two ways to work around this issue: Consume the output via pty.ExpectMatc...
Opengraph URL: https://github.com/coder/coder/issues/2122
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tests using Cobra with `ptytest` can hang on macOS (and Windows) unless the output is consumed","articleBody":"Unless `ptytest` output is consumed, a test can hang if a command outputs more than `1024` bytes (at least on macOS).\r\n\r\nThere are two ways to work around this issue:\r\n1. Consume the output via `pty.ExpectMatch()` (ensure no more than 1024 bytes are left unread)\r\n2. Use `cmd.SetOut(io.Discard)` instead\r\n\r\nSince using `ptytest` is a common pattern in our tests, it'd be a good idea to rewrite it so that a hang is not possible.\r\n\r\nUnless there's a bug to be fixed in underlying libraries, or changes to how ptys are configured, the most robust way to fix this would be for `ptytest` to buffer/consume _all_ command output, irregardless of a call to `ExpectMatch`.\r\n\r\nA reproduction of this bug exists as a test in https://github.com/coder/coder/pull/1629 (and will be merged in and skipped on macOS and Windows).","author":{"url":"https://github.com/mafredri","@type":"Person","name":"mafredri"},"datePublished":"2022-06-07T13:42:40Z","url":"https://github.com/coder/coder/issues/2122"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d7b537e7-fecb-183f-0b76-36dc7e077cde |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A378:3E4205:211225C:2C34470:6B018A71 |
| html-safe-nonce | c12aeed67a39793a6188ab28c5e2800373b7053455bfb402ccb6d82da9d3e9b9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzc4OjNFNDIwNToyMTEyMjVDOjJDMzQ0NzA6NkIwMThBNzEiLCJ2aXNpdG9yX2lkIjoiNzUyMjM0MjQ5Mjk0ODIzNjkxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b3d56a99d0bfa31c865d405ab12fc28752a78fe48589e8f7fea1b0aeba19d1a9 |
| hovercard-subject-tag | issue:1263327001 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/2122/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d02749fe2c92d9c822f51fa7af347606deb589fb2656db6865d01fcab0bdd065/coder/coder/issues/2122 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d02749fe2c92d9c822f51fa7af347606deb589fb2656db6865d01fcab0bdd065/coder/coder/issues/2122 |
| og:image:alt | Unless ptytest output is consumed, a test can hang if a command outputs more than 1024 bytes (at least on macOS). There are two ways to work around this issue: Consume the output via pty.ExpectMatc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mafredri |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width