fix #1353 os.get_line

pull/1358/head
Alvydas Vitkauskas 2019-07-29 01:23:41 +03:00 committed by Alexander Medvednikov
parent 45029f8c86
commit 8484de86c7
1 changed files with 6 additions and 5 deletions

View File

@ -509,11 +509,12 @@ pub fn filename(path string) string {
// get_line returns a one-line string from stdin
pub fn get_line() string {
str := get_raw_line()
if str[str.len - 1] == `\n` {
return str.substr(0, str.len - 1)
}
return str
$if windows {
return str.trim_right('\r\n')
}
$else {
return str.trim_right('\n')
}
}
// get_raw_line returns a one-line string from stdin along with '\n' if there is any