diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 94b1bf1c..1d4cc2e3 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -220,7 +220,13 @@ class WikiController < ApplicationController def convert_tex_to_pdf(tex_path) # TODO remove earlier PDF files with the same prefix # TODO handle gracefully situation where pdflatex is not available - logger.info `pdflatex --interaction=nonstopmode --output-directory #{File.dirname(tex_path)} #{File.basename(tex_path)}` + begin + wd = Dir.getwd + Dir.chdir(File.dirname(tex_path)) + logger.info `pdflatex --interaction=nonstopmode #{File.basename(tex_path)}` + ensure + Dir.chdir(wd) + end end def export_page_to_tex(file_path) diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 860f69a2..b4c94921 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -2,7 +2,7 @@ # Uncomment the line below to enable pdflatex tests; don't forget to comment them again # commiting to SVN -$INSTIKI_TEST_PDFLATEX = true +# $INSTIKI_TEST_PDFLATEX = true require File.dirname(__FILE__) + '/../test_helper' require 'wiki_controller'