コード例 #1
0
ファイル: xpoilflt.cpp プロジェクト: Amadiro/xara-cairo
void PluginFilterProcess::ProcessStdErr()
{
//	TRACEUSER("Gerry", _T("PluginFilterProcess::ProcessStdErr"));

	if (IsErrorAvailable())
	{
		wxTextInputStream tis(*GetErrorStream());

		// This assumes that the output is always line buffered
//		while (!GetErrorStream()->Eof())
		while (IsErrorAvailable())
		{
			wxString line;
			line << tis.ReadLine();
//			TRACEUSER("Gerry", _T("(stderr):%s"), line.c_str());

			if (!line.IsEmpty())
			{
				// If line begins "MESSAGE:" then it is a debug message and can be discarded
				wxString rest;
				if (line.StartsWith(_T("MESSAGE:"), &rest))
				{
//					TRACEUSER("Gerry", _T("XPFDebug:%s"), rest.c_str());
				}
				else if (line.StartsWith(_T("PROGRESS:"), &rest))
				{
//					TRACEUSER("Gerry", _T("XPFProgress:%s"), rest.c_str());
					if (m_pFilter)
					{
						unsigned long /*TYPENOTE: Correct*/ Val = wxStrtoul(rest.c_str(), NULL, 10);
						if (Val > 0)
						{
//							TRACEUSER("Gerry", _T("Setting progress to %d"), Val);
							m_pFilter->SetProgressBarCount((UINT32)Val);
						}
					}
				}
				else if (line.StartsWith(_T("WARNING:"), &rest))
				{
//					TRACEUSER("Gerry", _T("XPFWarning:%s"), rest.c_str());
					m_Warnings.Add(rest);
				}
				else if (line.StartsWith(_T("ERROR:"), &rest))
				{
//					TRACEUSER("Gerry", _T("XPFError:%s"), rest.c_str());
					m_Errors.Add(rest);
				}
				else
				{
//					TRACEUSER("Gerry", _T("Skipping stderr:%s"), line.c_str());
//					m_Errors.Add(line);
				}
			}
		}
	}
}
コード例 #2
0
ファイル: camprocess.cpp プロジェクト: Amadiro/xara-cairo
void CamProcess::ProcessStdErr()
{
	if (IsErrorAvailable())
	{
		wxTextInputStream tis(*GetErrorStream());

		// This assumes that the output is always line buffered
		while (IsErrorAvailable())
		{
			wxString line;
			line << tis.ReadLine();
//			TRACEUSER("Gerry", _T("(stderr):%s"), line.c_str());
		}
	}
}
コード例 #3
0
ファイル: pipedprocess.cpp プロジェクト: 469306621/Languages
bool PipedProcess::HasInput()
{
    if (IsErrorAvailable())
    {
        cbTextInputStream serr(*GetErrorStream());

        wxString msg;
        msg << serr.ReadLine();

		CodeBlocksEvent event(cbEVT_PIPEDPROCESS_STDERR, m_Id);
        event.SetString(msg);
		wxPostEvent(m_Parent, event);
// 		m_Parent->ProcessEvent(event);

        return true;
    }

    if (IsInputAvailable())
    {
        cbTextInputStream sout(*GetInputStream());

        wxString msg;
        msg << sout.ReadLine();

		CodeBlocksEvent event(cbEVT_PIPEDPROCESS_STDOUT, m_Id);
        event.SetString(msg);
		wxPostEvent(m_Parent, event);
// 		m_Parent->ProcessEvent(event);

        return true;
    }

    return false;
}
コード例 #4
0
ファイル: process.cpp プロジェクト: zinnjonas/MarkdownGui
bool MarkdownProcess::HasInput()
{
    bool hasInput = false;

    if ( IsInputAvailable() )
    {
        wxTextInputStream tis(*GetInputStream());

        // this assumes that the output is always line buffered
		m_file << tis.ReadLine() << wxT("\n");

//        m_parent->GetLogListBox()->Append(msg);

        hasInput = true;
    }

    if ( IsErrorAvailable() )
    {
        wxTextInputStream tis(*GetErrorStream());

        // this assumes that the output is always line buffered
		wxMessageBox(tis.ReadLine());
        hasInput = true;
    }

    return hasInput;
}
コード例 #5
0
ファイル: pipedprocess.cpp プロジェクト: 05storm26/codelite
bool PipedProcess::ReadAll(wxString &input)
{
	bool hasInput = false;
	bool cont1(true), cont2(true);

	wxTextInputStream tis(*GetInputStream());
	wxTextInputStream tie(*GetErrorStream());
	while(cont1 || cont2){
		cont1 = false;
		cont2 = false;
		while( IsInputAvailable() )
		{
			// this assumes that the output is always line buffered
			wxChar ch = tis.GetChar();
			input << ch;
			hasInput = true;
			cont1 = true;
		}

		while( IsErrorAvailable() )
		{
			// this assumes that the output is always line buffered
			wxChar ch = tie.GetChar();
			input << ch;
			hasInput = true;
			cont2 = true;
		}
	}
	return hasInput;
}
コード例 #6
0
ファイル: processManager.cpp プロジェクト: JimmyFarcy/I-Simpa
void processManager::LogOutput(bool &hasOutput, const wxString &label,float *outputProgression)
{
    hasOutput = false;

    if ( IsInputAvailable() )
    {
        wxTextInputStream tis(*GetInputStream());

        // this assumes that the output is always line buffered
        wxString msg;
        wxString output= tis.ReadLine();
        if(!this->outlogs.empty())
        {
            for(std::vector<smart_ptr<InterfLogger> >::iterator itlogs=this->outlogs.begin(); itlogs!=this->outlogs.end(); itlogs++)
            {
                (*(*itlogs)).LogMessage(output);
            }
        }
        if(outputProgression==NULL || output.Left(1)!="#")
        {
            msg << label << output;
            msg.Replace("%","%%"); //si il y a un seul % alors un bug apparait wxString attend un format du type %s ou %i par exemple
            if(output.Left(1)=="!")
            {
                wxLogWarning(msg);
            } else {
                wxLogMessage(msg);
            }
        } else {
            wxString prog=output.Right(output.Len()-1).Strip();
            *outputProgression=Convertor::ToFloat(prog);
        }

        hasOutput = true;
    }

    while ( IsErrorAvailable() )
    {
        wxTextInputStream tis(*GetErrorStream());
        const wxString& errMsg(tis.ReadLine());
        if(!this->outlogs.empty())
        {
            for(std::vector<smart_ptr<InterfLogger> >::iterator itlogs=this->outlogs.begin(); itlogs!=this->outlogs.end(); itlogs++)
            {
                (*(*itlogs)).LogError(errMsg);
            }
        }
        // this assumes that the output is always line buffered
        wxString msg;
        msg << _("Erreur exécutable :") << errMsg;
        msg.Replace("%","%%"); //si il y a un seul % alors un bug apparait wxString attend un format du type %s ou %i par exemple
        wxLogError(msg);

        hasOutput = true;
    }
}
コード例 #7
0
ファイル: nwxProcess.cpp プロジェクト: ncbi/osiris
size_t nwxProcess::ProcessIO(size_t nLimit)
{
  size_t nRtn = 0;
  bool bInputClosed = false;
  if(!m_bPaused)
  {
    if(!IsInputOpened())
    {
      if(m_sBuffer.Len())
      {
        m_sBuffer += "\n";
        ProcessLine(m_sBuffer.utf8_str(),m_sBuffer.Len(),false);
        m_sBuffer.Empty();
      }
      bInputClosed = true;
    }
    else 
    {
      while(IsInputAvailable() && (nRtn < nLimit))
      {
        nRtn += ProcessIO(GetInputStream(),m_sBuffer,false);
      }
    }
    if(!IsErrorOpened())
    {
      if(m_sBufferError.Len())
      {
        m_sBufferError += "\n";
        ProcessLine(m_sBufferError.utf8_str(),m_sBufferError.Len(),true);
        m_sBufferError.Empty();
      }
      if(bInputClosed && m_bRunning)
      {
    	  m_bRunning = false;
    	      // we are sometimes not notified when process ends
#ifndef __WXMSW__
    	  // need to clean up zombie because wx sometimes
    	  // fails to do this on the macintosh
    	  int nStatLoc;
    	  pid_t nPID;
    	  nPID = waitpid((pid_t)m_nPID,&nStatLoc,0);
    	  OnTerminate(m_nPID,nStatLoc);
#endif
      }
    }
    else 
    {
      while(IsErrorAvailable() && (nRtn < nLimit))
      {
        nRtn += ProcessIO(GetErrorStream(),m_sBufferError,true);
      }
    }
  }
  return nRtn;
}
コード例 #8
0
ファイル: pipedprocess.cpp プロジェクト: 469306621/Languages
void PipedProcess::ForfeitStreams()
{
    char buf[4096];
    if (IsErrorAvailable())
    {
        wxInputStream *in = GetErrorStream();
        while(in->Read(&buf, sizeof(buf)).LastRead())
            ;
    }
    if (IsInputAvailable())
    {
        wxInputStream *in = GetInputStream();
        while(in->Read(&buf, sizeof(buf)).LastRead())
            ;
    }
}
コード例 #9
0
ファイル: camprocess.cpp プロジェクト: Amadiro/xara-cairo
/********************************************************************************************

>	void CamLaunchProcess::ProcessStdErr()

	Author:		Phil_Martin (Xara Group Ltd) <*****@*****.**>
				Gerry_Iles (Xara Group Ltd) <*****@*****.**>
	Created:	19/May/2006
	Inputs:		-
	Outputs:	-
	Returns:	-
	Purpose:	Process anything the process writes to the error stream

********************************************************************************************/
void CamLaunchProcess::ProcessStdErr()
{
	if (IsErrorAvailable())
	{
		wxTextInputStream tis(*GetErrorStream());

		// This assumes that the output is always line buffered
		while (!GetErrorStream()->Eof())
		{
			wxString line;
			line << tis.ReadLine();
			TRACEUSER("Phil", _T("(stderr):%s\n"), line.c_str());
		}

		m_ReturnCode = 42;		// Signal failure
	}
}
コード例 #10
0
ファイル: axprocess.cpp プロジェクト: DDMAL/aruspix
bool AxProcess::HasEnded( )
{
	wxString msg;

	// redirect in now disabled (see constructor)
	// nothing will happen
	wxTextInputStream tis(*GetInputStream());
	wxTextInputStream tes(*GetErrorStream());
	
	// we don't know where Error is going to be output
    while ( IsInputAvailable() )
	{
		msg = tis.ReadLine();
		if ( msg.StartsWith("$ Success!") )
		{
			return true;
		}
		else if ( msg.StartsWith("$ Error: ") )
		{
			m_status = 255;
			return true;
		}
		if ( !msg.IsEmpty() && m_log )
			m_log->WriteString( msg + "\n" );
	}
    while ( IsErrorAvailable() )
	{
		msg = tes.ReadLine();
		if ( msg.StartsWith("$ Error: ") )
		{
			m_status = 255;
			return true;
		}
		if ( !msg.IsEmpty() && m_log )
			m_log->WriteString( msg + "\n" );
    }


    return false;
}
コード例 #11
0
ファイル: sysProcess.cpp プロジェクト: KrisShannon/pgadmin3
wxString sysProcess::ReadErrorStream()
{
	if (IsErrorAvailable())
		return ReadStream(GetErrorStream());
	return wxEmptyString;
}