-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix panic after getting terminal width in some CI environments #1581
Conversation
In some CI environments like Codefresh, k6 detects that it's running in a tty, the err returned by `terminal.GetSize()` is `nil`, yet `termWidth` is 0. Strange scenario, and we should fix our TTY check if possible, but it shouldn't panic with `divide by zero` anymore. Closes #1579
After this fix, runs on Codefresh show:
And the jobs pass successfully, though there's another issue actually making requests from Codefresh:
But that can presumably be resolved by updating ca-certificates, though I didn't troubleshoot it further. |
if err != nil { | ||
termWidth = defaultTermWidth | ||
tw, _, err := terminal.GetSize(fd) | ||
if tw > 0 && err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check might be overkill, but better safe than sorry in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 🤞 😅
Hi, I have the same error reported in #1579 and addressed here running a docker-compose CI build of K6:
Could you also let us know when the Docker Hub image will be released for 0.28 with this fix in it? Until then I am having to use the bleeding edge :master tag, which I would prefer not to do. I encountered the bug with the circleci config:
(so this was not limited to CodeFresh CI) I can confirm that running the same script with the K6 image Fixes the issue. |
Hi @luketn, sorry about that. We had some issues with the v0.28.0 release that caused the Docker image, Linux and Windows packages to not be built and published. This is now addressed, and you can pull the |
In some CI environments like Codefresh, k6 detects that it's running in a TTY, the err returned by
terminal.GetSize()
isnil
, yettermWidth
is 0. Strange scenario, and we should fix our TTY check if possible, but it shouldn't panic withdivide by zero
anymore.Closes #1579