diff -r aebaf590a838 -r f66c759d1111 src/relpipe-tr-grep.cpp --- a/src/relpipe-tr-grep.cpp Mon Dec 10 15:19:14 2018 +0100 +++ b/src/relpipe-tr-grep.cpp Mon Dec 10 21:17:26 2018 +0100 @@ -42,22 +42,22 @@ setlocale(LC_ALL, ""); CLI::untieStdIO(); CLI cli(argc, argv); - + int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; try { std::shared_ptr reader(Factory::create(std::cin)); - GrepHandler handler(std::cout); + GrepHandler handler(std::cout, cli.arguments()); reader->addHandler(&handler); reader->process(); resultCode = CLI::EXIT_CODE_SUCCESS; - } catch (RelpipeCLIException e) { + } catch (RelpipeCLIException& e) { fwprintf(stderr, L"Caught CLI exception: %ls\n", e.getMessge().c_str()); fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); resultCode = e.getExitCode(); - } catch (RelpipeReaderException e) { + } catch (RelpipeReaderException& e) { fwprintf(stderr, L"Caught Reader exception: %ls\n", e.getMessge().c_str()); fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); resultCode = CLI::EXIT_CODE_DATA_ERROR;