mirror of
https://github.com/nushell/nushell.git
synced 2025-05-02 00:54:25 +02:00
Trim newline from input
results (#5097)
This commit is contained in:
parent
6e7e2dbb97
commit
d0e636ae7a
@ -121,8 +121,14 @@ impl Command for Input {
|
|||||||
.into_pipeline_data());
|
.into_pipeline_data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just read a normal line of text
|
// Just read a normal line of text, and trim the newline at the end
|
||||||
let input = std::io::stdin().read_line(&mut buf);
|
let input = std::io::stdin().read_line(&mut buf);
|
||||||
|
if buf.ends_with('\n') {
|
||||||
|
buf.pop();
|
||||||
|
if buf.ends_with('\r') {
|
||||||
|
buf.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match input {
|
match input {
|
||||||
Ok(_) => Ok(Value::String {
|
Ok(_) => Ok(Value::String {
|
||||||
|
Loading…
Reference in New Issue
Block a user