Skip to content
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

Cygwin doesn't handle SIGWINCH properly #9113

Closed
EmilyGraceSeville7cf opened this issue Feb 11, 2021 · 9 comments
Closed

Cygwin doesn't handle SIGWINCH properly #9113

EmilyGraceSeville7cf opened this issue Feb 11, 2021 · 9 comments
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase

Comments

@EmilyGraceSeville7cf
Copy link

EmilyGraceSeville7cf commented Feb 11, 2021

Environment

Windows build number: Win32NT 10.0.19042.0 Microsoft Windows NT 10.0.19042.0
Windows Terminal version (if applicable): 1.5.10271.0

Steps to reproduce

Execute this Bash script and try resize Windows Terminal window:

#!/usr/bin/env bash
function outputText()
{
  local text=$1
  local -i textLength=${#text}

  local -i line="$(tput lines) / 2"
  local -i col="$(tput cols) / 2 - $textLength / 2"

  clear
  echo -en "\e[$line;${col}H$text"
}

trap "outputText 'Hello world!'" SIGWINCH

outputText 'Hello world!'
while true
do
    :
done

As you see Windows Terminal doesn't handles SIGWINCH properly. However everything works fine when I execute my script directly from Cygwin Terminal without Windows Terminal.

Expected behavior

Centered text is drawn on the screen after window resize.

Actual behavior

Text isn't centered after window resize.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 11, 2021
@EmilyGraceSeville7cf EmilyGraceSeville7cf changed the title Windows terminal doesn't handles SIGWINCH properly Windows terminal doesn't handle SIGWINCH properly Feb 11, 2021
@zadjii-msft
Copy link
Member

You know, I coulda swore we were tracking this somewhere. #4062, #1461, #7581 are related, but those are all crashes from resizing the underlying buffer, not "resizing the underlying buffer doesn't resize the Terminal".

Just a question - are you doing this in WSL or git bash? I'm trying this script out with gnome-terminal on my Ubuntu 18.04 distro, and the script doesn't seem to resize that terminal either.

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Feb 11, 2021
@EmilyGraceSeville7cf
Copy link
Author

EmilyGraceSeville7cf commented Feb 11, 2021

Just a question - are you doing this in WSL or git bash?

I'm doing it via Cygwin (please consider my settings.json for clarity):
image

I don't use WSL and Git Bash now.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 11, 2021
@j4james
Copy link
Collaborator

j4james commented Feb 11, 2021

You know, I coulda swore we were tracking this somewhere.

In issue #305 you decided that issue #281 would be the master thread for all window WINDOW_BUFFER_SIZE_EVENT / SIGWINCH discussion, so I suspect that's the one you're thinking of.

@zadjii-msft
Copy link
Member

You know, I might have actually been thinking of #5094

@j4james
Copy link
Collaborator

j4james commented Feb 11, 2021

I wouldn't have thought #5094 had anything to do with it. Unless I've misunderstood what is going on here, the script isn't resizing the window, it's just redrawing the text after it detects a resize. It works for me in both conhost and Windows Terminal when run from a WSL bash shell. I assumed the issue was something specific to Cygwin.

@zadjii-msft
Copy link
Member

Oh, maybe I'm misunderstanding what the sample was supposed to be doing. I thought it was trying to resize the terminal to some size, not listen for buffer size events.

This is working perfectly fine in WSL, so I'd agree that this is probably a cygwin-specific issue and should be filed on their issue tracker.

@DHowett DHowett added the Resolution-External For issues that are outside this codebase label Feb 12, 2021
@DHowett
Copy link
Member

DHowett commented Feb 12, 2021

Marking this one external. Thanks all!

@DHowett DHowett closed this as completed Feb 12, 2021
@DHowett DHowett added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Feb 12, 2021
@DHowett DHowett changed the title Windows terminal doesn't handle SIGWINCH properly Cygwin terminal doesn't handle SIGWINCH properly Feb 12, 2021
@DHowett DHowett changed the title Cygwin terminal doesn't handle SIGWINCH properly Cygwin doesn't handle SIGWINCH properly Feb 12, 2021
@EmilyGraceSeville7cf
Copy link
Author

EmilyGraceSeville7cf commented Feb 13, 2021

This is working perfectly fine in WSL, so I'd agree that this is probably a cygwin-specific issue and should be filed on their issue tracker.

I issued this problem to Cygwin developers and waiting for a feedback now. ;)

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 13, 2021
@determin1st
Copy link

determin1st commented May 4, 2024

SIGWINCH is unreliable, ive tested it doesnt work on fresh Debian install with gnome desktop. it should be abolished in preference to polling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

5 participants