git-svn-id: svn://db.shs.com.ru/pip@470 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-25 12:55:47 +00:00
parent 826db9e87d
commit ed059005f9
15 changed files with 101 additions and 78 deletions

View File

@@ -34,6 +34,7 @@ PRIVATE_DEFINITION_START(PIProcess)
#else
pid_t pid;
#endif
FILE * tf_in, * tf_out, * tf_err;
PRIVATE_DEFINITION_END(PIProcess)
@@ -48,7 +49,7 @@ PIProcess::PIProcess(): PIThread() {
is_exec = false;
g_in = g_out = g_err = false;
t_in = t_out = t_err = false;
tf_in = tf_out = tf_err = 0;
PRIVATE->tf_in = PRIVATE->tf_out = PRIVATE->tf_err = 0;
env = PIProcess::currentEnvironment();
}
@@ -139,12 +140,12 @@ void PIProcess::startProc(bool detached) {
if (!detached) PRIVATE->pid = pid_;
if (pid_ == 0) {
#endif
tf_in = tf_out = tf_err = 0;
PRIVATE->tf_in = PRIVATE->tf_out = PRIVATE->tf_err = 0;
//cout << "exec " << tf_in << ", " << tf_out << ", " << tf_err << endl;
//cout << f_out.path() << endl;
if (g_in) tf_in = freopen(f_in.path().data(), "r", stdin);
if (g_out) tf_out = freopen(f_out.path().data(), "w", stdout);
if (g_err) tf_err = freopen(f_err.path().data(), "w", stderr);
if (g_in) PRIVATE->tf_in = freopen(f_in.path().data(), "r", stdin);
if (g_out) PRIVATE->tf_out = freopen(f_out.path().data(), "w", stdout);
if (g_err) PRIVATE->tf_err = freopen(f_err.path().data(), "w", stderr);
#ifndef WINDOWS
if (!wd.isEmpty())
if (!chdir(wd.data()))