1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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

@@ -191,7 +191,7 @@ String OS_Unix::get_stdin_string(int64_t p_buffer_size) {
Vector<uint8_t> data;
data.resize(p_buffer_size);
if (fgets((char *)data.ptrw(), data.size(), stdin)) {
return String::utf8((char *)data.ptr());
return String::utf8((char *)data.ptr()).replace("\r\n", "\n").rstrip("\n");
}
return String();
}