mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
[PR #1394] [MERGED] Console: Fix problems when using CLI from MSYS2/GitBash/ConEmu #490
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/stenzek/duckstation/pull/1394
Author: @jstine35
Created: 1/5/2021
Status: ✅ Merged
Merged: 1/8/2021
Merged by: @stenzek
Base:
master← Head:msw_console_behavior📝 Commits (2)
c9b8dc1Console: Fix problems when using CLI from MSYS2/GitBash/ConEmuf26b094Console: Use ANSI escape codes and remove entirely Win32's legacy WriteConsoleA code.📊 Changes
1 file changed (+186 additions, -131 deletions)
View changed files
📝
src/common/log.cpp(+186 -131)📄 Description
what it does
test cases
remarks about standard outputs
I renamed some of the
ConsoleOutputfunctions toStandardOutput, though only ones static to the scope oflog.cppfor now. The terminology clarity can be helpful. The Console is very much a Microsoft Windows (MSW) term and is rarely used outside of the Windows ecosystem. Better terms are as follows:When you combine a Terminal with a Shell, you get an interactive Command Prompt we all know. You can run shells without the terminal, and you can run terminals without a shell. Windows Console is a terminal without a shell. Windows Terminal (the new UWP replacement for Console available on the Windows App Store) is also a terminal without a shell.
Anyway, whether it's a terminal or console isn't important. What is important is that it's writing to "standard output" -- this is a construct that can, at the discretion of the invoking user or process, be either:
This was all part of the rationale for me renaming 'ConsoleOutput' to 'StandardOutput'
WIN32vs._WIN32I used
_WIN32to identify the Windows SDK platform. I consider the define preferable as it's a first-class buildsystem define, similar to_MSC_VER/__clang__/__ANDROID__, etc. and such. By comparison,WIN32must be manually specified by the makefile/vcxproj. In many newer project templates, I've seen the define missing entirely. My recommendation is to migrate all your instances ofWIN32to_WIN32at some point.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.