|
a/src/windows/execmd_w.cpp |
|
b/src/windows/execmd_w.cpp |
|
... |
|
... |
253 |
////////////////////////////////////////////////////////
|
253 |
////////////////////////////////////////////////////////
|
254 |
// ExecCmd:
|
254 |
// ExecCmd:
|
255 |
|
255 |
|
256 |
class ExecCmd::Internal {
|
256 |
class ExecCmd::Internal {
|
257 |
public:
|
257 |
public:
|
258 |
Internal()
|
258 |
Internal(int flags)
|
259 |
: m_advise(0), m_provide(0), m_timeoutMs(1000), m_rlimit_as_mbytes(0) {
|
259 |
: m_advise(0), m_provide(0), m_timeoutMs(1000), m_rlimit_as_mbytes(0),
|
|
|
260 |
m_flags(flags) {
|
260 |
reset();
|
261 |
reset();
|
261 |
}
|
262 |
}
|
262 |
|
263 |
|
263 |
STD_UNORDERED_MAP<string, string> m_env;
|
264 |
STD_UNORDERED_MAP<string, string> m_env;
|
264 |
ExecCmdAdvise *m_advise;
|
265 |
ExecCmdAdvise *m_advise;
|
265 |
ExecCmdProvide *m_provide;
|
266 |
ExecCmdProvide *m_provide;
|
266 |
int m_timeoutMs;
|
267 |
int m_timeoutMs;
|
267 |
int m_rlimit_as_mbytes;
|
268 |
int m_rlimit_as_mbytes;
|
268 |
|
269 |
int m_flags;
|
|
|
270 |
|
269 |
// We need buffered I/O for getline. The Unix version uses netcon's
|
271 |
// We need buffered I/O for getline. The Unix version uses netcon's
|
270 |
string m_buf; // Buffer. Only used when doing getline()s
|
272 |
string m_buf; // Buffer. Only used when doing getline()s
|
271 |
size_t m_bufoffs; // Pointer to current 1st byte of useful data
|
273 |
size_t m_bufoffs; // Pointer to current 1st byte of useful data
|
272 |
bool m_killRequest;
|
274 |
bool m_killRequest;
|
273 |
string m_stderrFile;
|
275 |
string m_stderrFile;
|
|
... |
|
... |
358 |
private:
|
360 |
private:
|
359 |
ExecCmd::Internal *m_parent;
|
361 |
ExecCmd::Internal *m_parent;
|
360 |
bool m_active;
|
362 |
bool m_active;
|
361 |
};
|
363 |
};
|
362 |
|
364 |
|
363 |
ExecCmd::ExecCmd()
|
365 |
ExecCmd::ExecCmd(int flags)
|
364 |
{
|
366 |
{
|
365 |
m = new Internal();
|
367 |
m = new Internal(flags);
|
366 |
if (m) {
|
368 |
if (m) {
|
367 |
m->reset();
|
369 |
m->reset();
|
368 |
}
|
370 |
}
|
369 |
}
|
371 |
}
|
370 |
|
372 |
|
|
... |
|
... |
701 |
|
703 |
|
702 |
// Set up members of the STARTUPINFO structure.
|
704 |
// Set up members of the STARTUPINFO structure.
|
703 |
// This structure specifies the STDIN and STDOUT handles for redirection.
|
705 |
// This structure specifies the STDIN and STDOUT handles for redirection.
|
704 |
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
|
706 |
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
|
705 |
siStartInfo.cb = sizeof(STARTUPINFO);
|
707 |
siStartInfo.cb = sizeof(STARTUPINFO);
|
|
|
708 |
if (m->m_flags & EXF_SHOWWINDOW) {
|
|
|
709 |
siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
|
|
|
710 |
} else {
|
706 |
siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
711 |
siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
|
|
712 |
}
|
707 |
siStartInfo.hStdOutput = hOutputWrite;
|
713 |
siStartInfo.hStdOutput = hOutputWrite;
|
708 |
siStartInfo.hStdInput = hInputRead;
|
714 |
siStartInfo.hStdInput = hInputRead;
|
709 |
siStartInfo.hStdError = hErrorWrite;
|
715 |
siStartInfo.hStdError = hErrorWrite;
|
710 |
// This is to hide the console when starting a cmd line command from
|
716 |
// This is to hide the console when starting a cmd line command from
|
711 |
// the GUI. Also note STARTF_USESHOWWINDOW above
|
717 |
// the GUI. Also note STARTF_USESHOWWINDOW above
|