From 7f6611cded8c1591f1aa1a4c7d70505cb21e7967 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 9 Aug 2014 18:42:47 +0200 Subject: Changed FunctionExternalTextFormatter to execute formatter inside shell * otherwise one has to pass the full path to the command ** additionally it is much easier to enable passing arguments to the external formatter this way * modified external function parameter accordingly * updated external text formatter test case --- src/function/external_text_formatter.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/function/external_text_formatter.cc') diff --git a/src/function/external_text_formatter.cc b/src/function/external_text_formatter.cc index 048f81a..03902e9 100644 --- a/src/function/external_text_formatter.cc +++ b/src/function/external_text_formatter.cc @@ -40,21 +40,21 @@ inline xercesc::DOMNode* importDocumentElement( namespace InputXSLT { DomDocumentCache::document_ptr FunctionExternalTextFormatter::constructDocument( - boost::filesystem::path formatterPath, - std::string stdinText + std::string formatterCommand, + std::string stdinText ) const { DomDocumentCache::document_ptr domDocument( DomDocumentCache::createDocument("content") ); boost::process::context context; + context.environment = boost::process::self::get_environment(); context.stdout_behavior = boost::process::capture_stream(); context.stdin_behavior = boost::process::capture_stream(); boost::process::child formatterProcess( - boost::process::launch( - formatterPath, - std::vector{""}, + boost::process::launch_shell( + formatterCommand, context ) ); @@ -68,7 +68,7 @@ DomDocumentCache::document_ptr FunctionExternalTextFormatter::constructDocument( boost::process::status status = formatterProcess.wait(); ResultNodeFacade result(domDocument.get(), "output"); - result.setAttribute("formatter", formatterPath.filename().string()); + result.setAttribute("formatter", formatterCommand); result.setAttribute("code", std::to_string(status.exit_status())); if ( status.exited() ) { -- cgit v1.2.3