Convert line breaks to \n and strip line break from the end of string returned by OS::read_string_from_stdin/OS::get_stdin_string.

This commit is contained in:
Pāvels Nadtočajevs
2024-11-22 16:26:25 +02:00
parent 0c45ace151
commit e9b57fce82
3 changed files with 3 additions and 2 deletions

View File

@@ -1751,7 +1751,7 @@ String OS_Windows::get_stdin_string(int64_t p_buffer_size) {
data.resize(p_buffer_size);
DWORD count = 0;
if (ReadFile(GetStdHandle(STD_INPUT_HANDLE), data.ptrw(), data.size(), &count, nullptr)) {
return String::utf8((const char *)data.ptr(), count);
return String::utf8((const char *)data.ptr(), count).replace("\r\n", "\n").rstrip("\n");
}
return String();