Commit d04fe820 authored by zhujiashun's avatar zhujiashun

trim last newline in get command line

parent 13ff234d
...@@ -70,7 +70,8 @@ ssize_t ReadCommandLine(char* buf, size_t len, bool with_args) { ...@@ -70,7 +70,8 @@ ssize_t ReadCommandLine(char* buf, size_t len, bool with_args) {
return nr; return nr;
} else { } else {
for (ssize_t i = 0; i < nr; ++i) { for (ssize_t i = 0; i < nr; ++i) {
if (buf[i] == '\0') { // The result in macos is ended with '\n'
if (buf[i] == '\0' || buf[i] == '\n') {
return i; return i;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment