[Jsmooth-cvs] jsmooth/skeletons/util-core Process.cpp, 1.2, 1.3 testmain.cpp, 1.3, 1.4
Status: Beta
Brought to you by:
reyes
From: Rodrigo R. <re...@us...> - 2007-05-04 20:54:18
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/util-core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9552 Modified Files: Process.cpp testmain.cpp Log Message: Fixes the Process class opening a DOS console when redirection is enabled Index: Process.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Process.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Process.cpp 1 May 2007 19:40:16 -0000 1.2 --- Process.cpp 4 May 2007 20:53:28 -0000 1.3 *************** *** 77,82 **** info.hStdOutput = m_redirectHandle; info.hStdError = m_redirectHandle; ! info.dwFlags = STARTF_USESTDHANDLES; } // string exeline = StringUtils::fixQuotes(exepath) + " " + arguments; int res = CreateProcess(NULL, (char*)m_commandline.c_str(), --- 77,85 ---- info.hStdOutput = m_redirectHandle; info.hStdError = m_redirectHandle; ! info.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; ! info.lpTitle = NULL; ! info.wShowWindow = SW_HIDE; // OR SW_SHOWMINIMIZED? SW_SHOWMINNOACTIVE? } + // string exeline = StringUtils::fixQuotes(exepath) + " " + arguments; int res = CreateProcess(NULL, (char*)m_commandline.c_str(), Index: testmain.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/testmain.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testmain.cpp 28 Apr 2007 08:47:57 -0000 1.3 --- testmain.cpp 4 May 2007 20:53:28 -0000 1.4 *************** *** 25,28 **** --- 25,29 ---- #include <winnls.h> #include "FileUtils.h" + #include "Process.h" void _debugOutput(const std::string& text) *************** *** 37,57 **** int main(int argc, char *argv[]) { ! char buffer[256]; ! buffer[0] = 0; ! int res = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, ! buffer, 255); ! if (res > 0) ! printf("result: %s\n", buffer); ! std::string cmdlinetest = " \"this is my\ test\\\" \"here and then\""; ! cmdlinetest = " \"this is my\ test here\\\" \"and\" \"then\""; ! printf("splitting line <%s>\n", cmdlinetest.c_str()); ! std::vector<std::string> args = StringUtils::split(cmdlinetest, " \t\n\r", "\"'", false, false); ! for (int i=0; i<args.size(); i++) ! { ! printf("ARG[%d]=%s\n", i, args[i].c_str(), false, false); ! } // std::string fqmethod = "void mytest1(java.lang.String test[ ] ) "; --- 38,68 ---- int main(int argc, char *argv[]) { ! // char buffer[256]; ! // buffer[0] = 0; ! // int res = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, ! // buffer, 255); ! // if (res > 0) ! // printf("result: %s\n", buffer); + std::string exeline = "C:\\Program Files\\Java\\jdk1.5.0_11\\bin\\java.exe -version"; + string tmpfilename = FileUtils::createTempFileName(".tmp"); ! Process proc(exeline, true); ! proc.setRedirect(tmpfilename); ! proc.run(); ! proc.join(); ! ! std::string voutput = FileUtils::readFile(tmpfilename); ! // printf("GOT: %s\n", voutput.c_str()); ! ! // std::string cmdlinetest = " \"this is my\ test\\\" \"here and then\""; ! // cmdlinetest = " \"this is my\ test here\\\" \"and\" \"then\""; ! // printf("splitting line <%s>\n", cmdlinetest.c_str()); ! // std::vector<std::string> args = StringUtils::split(cmdlinetest, " \t\n\r", "\"'", false, false); ! // for (int i=0; i<args.size(); i++) ! // { ! // printf("ARG[%d]=%s\n", i, args[i].c_str(), false, false); ! // } // std::string fqmethod = "void mytest1(java.lang.String test[ ] ) "; |