equal
deleted
inserted
replaced
14 * You should have received a copy of the GNU General Public License |
14 * You should have received a copy of the GNU General Public License |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 */ |
16 */ |
17 #include <cstdlib> |
17 #include <cstdlib> |
18 #include <memory> |
18 #include <memory> |
|
19 #include <functional> |
19 |
20 |
20 #include <relpipe/writer/RelationalWriter.h> |
21 #include <relpipe/writer/RelationalWriter.h> |
21 #include <relpipe/writer/RelpipeWriterException.h> |
22 #include <relpipe/writer/RelpipeWriterException.h> |
22 #include <relpipe/writer/Factory.h> |
23 #include <relpipe/writer/Factory.h> |
23 #include <relpipe/writer/TypeId.h> |
24 #include <relpipe/writer/TypeId.h> |
44 try { |
45 try { |
45 CLIParser cliParser; |
46 CLIParser cliParser; |
46 Configuration configuration = cliParser.parse(cli.arguments()); |
47 Configuration configuration = cliParser.parse(cli.arguments()); |
47 X11Command command; |
48 X11Command command; |
48 std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout)); |
49 std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout)); |
49 command.process(configuration, writer); |
50 command.process(configuration, writer, std::bind(fflush, stdout)); // std::bind(fflush, XXX) Factory::create(XXX) must be the same stream XXX |
50 resultCode = CLI::EXIT_CODE_SUCCESS; |
51 resultCode = CLI::EXIT_CODE_SUCCESS; |
51 } catch (RelpipeWriterException& e) { |
52 } catch (RelpipeWriterException& e) { |
52 fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str()); |
53 fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str()); |
53 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
54 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
54 resultCode = CLI::EXIT_CODE_DATA_ERROR; |
55 resultCode = CLI::EXIT_CODE_DATA_ERROR; |