#include "Server.ih"
// Custom includes
+#include <errno.h>
#include <iostream>
#include <boost/algorithm/string/trim.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
: handle_ (handle),
event_ ("senf::console::Server", senf::membind(&Server::newClient, this),
handle_, scheduler::FdEvent::EV_READ),
- root_ (senf::console::root().thisptr()), mode_ (Automatic)
+ root_ (senf::console::root().thisptr()), mode_ (Automatic),
+ name_ (::program_invocation_short_name)
{}
prefix_ void senf::console::Server::newClient(int event)
handle_.facet<senf::TCPSocketProtocol>().shutdown(senf::TCPSocketProtocol::ShutRD);
}
catch (std::exception & ex) {
- stream() << ex.what() << std::endl;
+ std::string msg (ex.what());
+ std::string::size_type i (msg.find("-- \n"));
+ if (i != std::string::npos)
+ msg = msg.substr(i+4);
+ stream() << msg << std::endl;
}
catch (...) {
stream() << "unidentified error (unknown exception thrown)" << std::endl;