qepcad-B/qepcad-B-tty.patch

46 lines
1.6 KiB
Diff
Raw Normal View History

--- ./source/db/SINGULAR.c.orig 2013-11-21 15:54:01.972430325 -0700
+++ ./source/db/SINGULAR.c 2015-09-03 19:42:46.612130230 -0600
@@ -1,6 +1,7 @@
#include "SINGULAR.h"
#include <iostream>
#include <string>
+#include <unistd.h>
using namespace std;
@@ -15,6 +16,12 @@ SingularServer::SingularServer(string Si
if (childpid == 0) {
intoSingular.setStdinToPipe();
outofSingular.setStdoutToPipe();
+ outofSingular.setStderrToPipe();
+ intoSingular.closeIn();
+ intoSingular.closeOut();
+ outofSingular.closeIn();
+ outofSingular.closeOut();
+ setsid();
// Begin: Just for debug!!
//system("/home/wcbrown/bin/Singular -q --no-warn --min-time=0.001 --ticks-per-sec=1000 | tee /tmp/SingOutLog");
@@ -30,9 +37,10 @@ SingularServer::SingularServer(string Si
"--ticks-per-sec=1000",
NULL);
perror("SingularServer Constructor: Singular startup failed! (Set SINGULAR environment variable)");
- outofSingular.closeOut();
exit(0);
}
+ intoSingular.closeIn();
+ outofSingular.closeOut();
}
SingularServer::~SingularServer()
--- ./source/db/unnamedpipe.h.orig 2015-09-03 19:51:49.424196005 -0600
+++ ./source/db/unnamedpipe.h 2015-09-03 19:51:55.462718382 -0600
@@ -113,6 +113,7 @@ public:
int fdout() { return fd[1]; }
int setStdinToPipe() { return dup2(fdin(),fileno(stdin)); }
int setStdoutToPipe() { return dup2(fdout(),fileno(stdout)); }
+ int setStderrToPipe() { return dup2(fdout(),fileno(stderr)); }
void closeIn() {
if (_in) { delete _in; _in = 0; }
if (openmask[0]) { close(fd[0]); openmask[0] = false; }