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

'GetConsoleScreenBufferInfo' failed on git bash #1188

Open
LiShanwenGit opened this issue Dec 1, 2022 · 10 comments
Open

'GetConsoleScreenBufferInfo' failed on git bash #1188

LiShanwenGit opened this issue Dec 1, 2022 · 10 comments
Labels

Comments

@LiShanwenGit
Copy link

LiShanwenGit commented Dec 1, 2022

I get the terminal size of git bash shell, but the function return error code, like this:

   CONSOLE_SCREEN_BUFFER_INFO csbi;
    switch (1) {
    case 0: nhandle = STD_INPUT_HANDLE;
        break;
    case 1: nhandle = STD_OUTPUT_HANDLE;
        break;
    case 2: nhandle = STD_ERROR_HANDLE;
        break;
    }
    handle = GetStdHandle(nhandle);
    if (handle == NULL)
        printf("handle cannot be retrieved");
    if (handle == INVALID_HANDLE_VALUE)
        printf("handle is invalid\n");
    if (GetConsoleScreenBufferInfo(handle, &csbi) ==0)
        printf("Error: get info failed\n"); 

the result print Error: get info failed.
so, I could not know why, can you help me?, thank you a lot. : )

@LiShanwenGit
Copy link
Author

the compiler is:
$ gcc -v
Using built-in specs.
COLLECT_GCC=D:\MSYS2\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/MSYS2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mi
ngw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-sta
tic --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --dis
able-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl
=/mingw64 --with-pkgversion='Rev6, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc+

  • --with-stage1-ldflags=-static-libstdc++
    Thread model: posix
    Supported LTO compression algorithms: zlib zstd
    gcc version 12.2.0 (Rev6, Built by MSYS2 project)

@LiShanwenGit
Copy link
Author

LiShanwenGit commented Dec 1, 2022

image
image

the bash is ok, but the git-bash is bad, : (

@k-takata
Copy link
Contributor

k-takata commented Dec 1, 2022

@LiShanwenGit
Copy link
Author

You might want to see this: https://github.com/mintty/mintty/wiki/Tips#inputoutput-interaction-with-alien-programs

Great, it's good, thank you : )
solution:

  1. create a 'git-bash.config' file in /etc
  2. add 'MSYS=enable_pcon' into git-bash.config file
  3. restart git-bash shell

@mintty
Copy link
Owner

mintty commented Dec 2, 2022

Thanks, added this option to the wiki.

@Biswa96
Copy link
Contributor

Biswa96 commented Dec 2, 2022

FYI, msys2 enables conpty by-default from this date https://www.msys2.org/news/#2022-09-24-conpty-support-enabled-by-default

@mintty
Copy link
Owner

mintty commented Dec 2, 2022

Thanks, noted in the wiki.

@LiShanwenGit
Copy link
Author

Hi, gays, Thank you very much for your help. However, to my surprise, the performance difference between the two is so large. When git bash add "MSYS=enable_pcon", its terminal output efficiency decreases greatly. Ithink that the terminal of Windows really needs to be improved.

@mintty
Copy link
Owner

mintty commented Dec 10, 2022

We're talking here about mintty, not Windows terminal, right?
And what does uname -a say for you?

@LiShanwenGit
Copy link
Author

LiShanwenGit commented Dec 10, 2022

Yes, you are right, this is not a problem with mintty, but a problem with Windows, just to mention this.
thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants