diff --git a/ext/libexecstream/win/exec-stream-impl.cpp b/ext/libexecstream/win/exec-stream-impl.cpp index 0add2045d..c2effb0e0 100644 --- a/ext/libexecstream/win/exec-stream-impl.cpp +++ b/ext/libexecstream/win/exec-stream-impl.cpp @@ -167,10 +167,14 @@ void exec_stream_t::start( std::string const & program, std::string const & argu ZeroMemory( &si, sizeof( si ) ); si.cb=sizeof( si ); si.wShowWindow = SW_HIDE; - si.dwFlags = STARTF_USESHOWWINDOW; + si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; + si.hStdInput = in.r(); + si.hStdOutput = out.w(); + si.hStdError = err.w(); + PROCESS_INFORMATION pi; ZeroMemory( &pi, sizeof( pi ) ); - if( !CreateProcess( 0, const_cast< char * >( command.c_str() ), 0, 0, TRUE, DETACHED_PROCESS, 0, 0, &si, &pi ) ) { + if( !CreateProcess( 0, const_cast< char * >( command.c_str() ), 0, 0, TRUE, 0, 0, 0, &si, &pi ) ) { throw os_error_t( "exec_stream_t::start: CreateProcess failed.\n command line was: "+command ); } diff --git a/src/base/ct2ctml.cpp b/src/base/ct2ctml.cpp index 787f78750..75fabeb01 100644 --- a/src/base/ct2ctml.cpp +++ b/src/base/ct2ctml.cpp @@ -87,10 +87,13 @@ void ct2ctml(const char* file, const int debug) " import sys\n" << " sys.stderr = sys.stdout\n" << " import ctml_writer\n" << - " ctml_writer.convert(r'" << file << "')\n"; + " ctml_writer.convert(r'" << file << "')\n" << + " sys.exit(0)\n\n" + "sys.exit(7)\n"; python.close_in(); std::string line; - while (std::getline(python.out(), line).good()) { + while (python.out().good()) { + std::getline(python.out(), line); output_stream << line << std::endl;; } python.close(); @@ -110,10 +113,13 @@ void ct2ctml(const char* file, const int debug) stringstream message; message << "Error converting input file \"" << file << "\" to CTML.\n"; message << "Python command was: '" << pypath() << "'\n"; + message << "The exit code was: " << python_exit_code << "\n"; if (python_output.size() > 0) { message << "-------------- start of converter log --------------\n"; message << python_output << std::endl; message << "--------------- end of converter log ---------------"; + } else { + message << "The command did not produce any output." << endl; } throw CanteraError("ct2ctml", message.str()); }