]> git.lyx.org Git - features.git/commitdiff
Fix CAS input on windows (bug 10262)
authorGeorg Baum <baum@lyx.org>
Sun, 3 Jul 2016 17:48:15 +0000 (19:48 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 3 Jul 2016 17:48:15 +0000 (19:48 +0200)
This is the well known file locking problem: The TempFile class keeps the
created file locked for the own process, and this prevents the CAS to read it.

src/mathed/MathExtern.cpp
status.22x

index 7fbb4af732fb10fa941cb57d9d01c50d3a0d758b..c6ba26fc6108290e4ea7d46d7970514a6d13df86 100644 (file)
@@ -1000,8 +1000,13 @@ namespace {
        {
                // In order to avoid parsing problems with command interpreters
                // we pass input data through a file
-               TempFile tempfile("casinput");
-               FileName const cas_tmpfile = tempfile.name();
+               // Since the CAS is supposed to read the temp file we need
+               // to unlock it on windows (bug 10262).
+               auto_ptr<TempFile> tempfile(new TempFile("casinput"));
+               tempfile->setAutoRemove(false);
+               FileName const cas_tmpfile = tempfile->name();
+               tempfile.reset();
+
                if (cas_tmpfile.empty()) {
                        lyxerr << "Warning: cannot create temporary file."
                               << endl;
@@ -1015,6 +1020,7 @@ namespace {
                lyxerr << "calling: " << cmd
                       << "\ninput: '" << data << "'" << endl;
                cmd_ret const ret = runCommand(command);
+               cas_tmpfile.removeFile();
                return ret.second;
        }
 
index f4d5840c259da48179f32f64055ac9ef2acf50b9..e384377c64c2cbef6141394c8c255055eb168e29 100644 (file)
@@ -81,6 +81,8 @@ What's new
 
 - Load math packages automatically with JSS template (bug 9242).
 
+- Calling a Computer Algebra System from LyX works again (windows only bug 10262).
+
 
 * LYX2LYX