aboutsummaryrefslogtreecommitdiff
path: root/src/function
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-08-09 18:42:47 +0200
committerAdrian Kummerlaender2014-08-09 18:42:47 +0200
commit7f6611cded8c1591f1aa1a4c7d70505cb21e7967 (patch)
tree6be359d9f6b718c8ceea991f62fd12ef5c4c43c9 /src/function
parent97b17caeeb8512e2af332d7095fca4cad160a980 (diff)
downloadInputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar.gz
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar.bz2
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar.lz
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar.xz
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.tar.zst
InputXSLT-7f6611cded8c1591f1aa1a4c7d70505cb21e7967.zip
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
Diffstat (limited to 'src/function')
-rw-r--r--src/function/external_text_formatter.cc12
-rw-r--r--src/function/external_text_formatter.h4
-rw-r--r--src/function/generate.cc2
3 files changed, 8 insertions, 10 deletions
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<std::string>{""},
+ 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() ) {
diff --git a/src/function/external_text_formatter.h b/src/function/external_text_formatter.h
index 27f2fc7..4788784 100644
--- a/src/function/external_text_formatter.h
+++ b/src/function/external_text_formatter.h
@@ -9,7 +9,7 @@ namespace InputXSLT {
class FunctionExternalTextFormatter : public FunctionBase<
FunctionExternalTextFormatter,
- boost::filesystem::path,
+ std::string,
std::string
> {
public:
@@ -19,7 +19,7 @@ class FunctionExternalTextFormatter : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
- boost::filesystem::path,
+ std::string,
std::string
) const;
diff --git a/src/function/generate.cc b/src/function/generate.cc
index 0c5c664..df5e65b 100644
--- a/src/function/generate.cc
+++ b/src/function/generate.cc
@@ -37,8 +37,6 @@ DomDocumentCache::document_ptr FunctionGenerate::constructDocument(
xalan::XalanOutputStreamPrintWriter writer(output);
xalan::FormatterToXML targetFormatter(writer);
- targetFormatter.setDoIndent(true);
-
transformer.generate(
inputSource,
transformationSource,