diff options
author | Adrian Kummerlaender | 2014-08-20 22:28:15 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2014-08-20 22:28:15 +0200 |
commit | 2c89112141530617b51af8c41211c2507ec8c738 (patch) | |
tree | c467e07340c55cf81090315e79e85af05b542647 /src/function/external_command.cc | |
parent | b31f9170c2bc2330442070968d3cb334cadb5faa (diff) | |
download | InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar.gz InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar.bz2 InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar.lz InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar.xz InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.tar.zst InputXSLT-2c89112141530617b51af8c41211c2507ec8c738.zip |
Setting the correct work directory in FunctionExternalCommand
* changed the XObjectValue constructor to accept a pointer to FilesystemContext instead of instantiating the context by itself
* the FilesystemContext is now instantiated in the "callConstructDocument" member method of "FunctionBase"
** a const reference to FilesystemContext is passed to all "constructDocument" member method implementations
* the FilesystemContext is currently only used by FunctionExternal command to set the correct work directory in "boost::process::context"
** this is required so calling external commands from inside a stylesheet works as expected
*** i.e. from inside the directory the stylesheet is located in
* modified all remaining external function implementations accordingly
Diffstat (limited to 'src/function/external_command.cc')
-rw-r--r-- | src/function/external_command.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/function/external_command.cc b/src/function/external_command.cc index 7d91a9a..3819a43 100644 --- a/src/function/external_command.cc +++ b/src/function/external_command.cc @@ -40,6 +40,7 @@ inline xercesc::DOMNode* importDocumentElement( namespace InputXSLT { DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument( + const FilesystemContext& fsContext, std::string command, boost::optional<std::string> input ) const { @@ -51,6 +52,9 @@ DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument( context.environment = boost::process::self::get_environment(); context.stdout_behavior = boost::process::capture_stream(); context.stdin_behavior = boost::process::capture_stream(); + context.work_directory = boost::filesystem::canonical( + fsContext.getBase().parent_path() + ).string(); boost::process::child commandProcess( boost::process::launch_shell(command, context) |