tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: wip/mu: std::getline returning falsy value
On Wed, Apr 17, 2024 at 07:55:12PM +0000, Kevin Bloom wrote:
> Hi all,
>
> I'm working on wip/mu and I've ran into a strange issue. Basically,
> it appears that line 121 in lib/utils/mu-readline.cc is returning a
> falsy value and is causing the `server` command to quit immediately
> after starting. I don't know much about C++ but it's my understanding
> that std::getline returns falsy if there is a bad char input or issue
> with the stream or something.
The function returns the "basic_istream" that is passed as first
argument. Testing that as a bool is equivalent to !fail() [inherited
from std::basic_ios<CharT,Traits>::fail via operator bool from the same
class] and assuming that the (output) string size is not exceeded, this
means no characters were extracted from the stream (not even the line
delimiter).
This would happen e.g. if the stdin of the program has been closed.
Martin
Home |
Main Index |
Thread Index |
Old Index