tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/mu: std::getline returning falsy value



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. Is there something special that should
be done here for NetBSD?

Removing that if just causes the server to loop endlessly without
giving the option to input any commands -- as if it's not waiting
for any input just fails and keeps going.

Any ideas here?

Below is the snippet from that file.

=== snip ===

std::string
Mu::read_line(bool& do_quit)
{
#if HAVE_READLINE
	if (is_a_tty) {
		auto buf = readline(";; mu% ");
		if (!buf) {
			do_quit = true;
			return {};
		}
		std::string line{buf};
		::free(buf);
		return line;
	}
#endif /*HAVE_READLINE*/

	std::string line;
	mu_print(";; mu> ");
	if (!std::getline(std::cin, line))
		do_quit = true;

	return line;
}

=== end snip ===

Thanks,

Kev


Home | Main Index | Thread Index | Old Index