]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcall.C
hopefully fix tex2lyx linking.
[lyx.git] / src / support / forkedcall.C
index 419fe5aac70818d200f7a4aabba726204187ce62..e1d5ef50cfd04655cc54f83479cc4438c06fda5c 100644 (file)
@@ -38,6 +38,7 @@
 #include <boost/bind.hpp>
 
 #include <vector>
+#include <cerrno>
 
 #ifdef _WIN32
 # define SIGHUP 1
 # include <windows.h>
 
 #else
-# include <cerrno>
 # include <csignal>
 # include <cstdlib>
-# include <unistd.h>
-# include <sys/types.h>
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 # include <sys/wait.h>
 #endif
 
@@ -180,7 +181,9 @@ void ForkedProcess::kill(int tol)
                return;
        }
 
-       int const tolerance = std::max(0, tol);
+       // The weird (std::max)(a,b) signature prevents expansion
+       // of an evil MSVC macro.
+       int const tolerance = (std::max)(0, tol);
        if (tolerance == 0) {
                // Kill it dead NOW!
                Murder::killItDead(0, pid());
@@ -358,11 +361,8 @@ int Forkedcall::generateChild()
                lyxerr << "</command>" << std::endl;
        }
 
-#if defined (__EMX__)
-       pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
-                                  argv[0], &*argv.begin());
-#elif defined (_WIN32)
-       pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin());
+#ifdef _WIN32
+       pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin());
 #else // POSIX
        pid_t const cpid = ::fork();
        if (cpid == 0) {