Пример #1
0
void mxExportPreview::OnProcTerminate (wxProcessEvent & event) {
    _LOG("mxExportPreview::OnProcessTerminate");
    if (pid<=0||!the_process||event.GetPid()!=pid) return;
    int exit_code = event.GetExitCode();
    delete the_process;
    the_process=NULL;
    if (exit_code!=0) {
        SetMessage(_Z("Error al intentar exportar"));
        state=mxEP_NONE;
        return;
    }

    switch(state) {

    case mxEP_NONE: { // no deberia pasar nunca
        return;
    }
    break;

    case mxEP_CHECK: { // estaba armando el psd, ahora exportar
        wxString command;
        command<<config->psexport_command<<_T(" \"")<<temp_filename<<".psd"<<_T("\" \"")<<temp_filename<<".exp"<<_T("\"");
        if (config->lang[LS_BASE_ZERO_ARRAYS]) command<<_T(" --base_zero_arrays=1");
        int lang_id = mxID_FILE_EXPORT_LANG_FIRST+1+combo_lang->GetCurrentSelection();
        command<<" --lang="<<utils->GetExportLangCode(lang_id);

        the_process = new wxProcess(this->GetEventHandler());
        _LOG("mxExportPreview, command="<<command);
        pid = wxExecute(command,wxEXEC_ASYNC,the_process);
        state = mxEP_EXP;

    }
    break;

    case mxEP_EXP: { // estaba exportando, mostrar
        state = mxEP_NONE;
        code_ctrl->LoadFile(temp_filename+".exp");
    }
    break;

    case mxEP_UPDATE: {  // se interrumpio lo que estaba haciendo para empezar otra vez
        pid = 0;
        state = mxEP_NONE;
        UpdatePrev();
    }
    break;

    default:
        break;
    }
}
Пример #2
0
void VersionChecker::OnTerminate(wxProcessEvent& e) {
    assert(m_process);

    // if version check returned correctly and print sth.
    // otherwise there is a bug!
    if( e.GetExitCode() == 255 && m_process->IsInputAvailable()) {
        wxTextInputStream is(*m_process->GetInputStream());
        wxString version = is.ReadLine();
        if (version != SC::A2S(SZARP_VERSION))
            m_is_new_version = true;
    } else {
        wxLogError( _("This should never happen. Probably there is a bug in version checking.") );
        std::wcerr << "Dump stdout:" << std::endl;
        DumpStream( m_process->GetInputStream() );
        std::wcerr << "Dump stderr:" << std::endl;
        DumpStream( m_process->GetErrorStream() );
    }

    delete m_process;
    m_process = NULL;

    if (m_is_new_version) {
        ShowNewVersionMessage();
        NotifyNewVersionAvailable();
    } else
        Start();
}
Пример #3
0
void SigUIFrame::OnTerminateInstall(wxProcessEvent &event)
{
    wxEndBusyCursor();
    wxWakeUpIdle();
    if (event.GetExitCode() == 0) {
	m_sig_candidates->Clear();
	wxLogMessage(_("Successfully installed new virus signatures\n"));
	reload();
    } else {
	bool had_errors = false;
	wxInputStream *err = m_siginst_process->GetErrorStream();
	wxTextInputStream tis(*err);

	while (!err->Eof()) {
	    wxString line = tis.ReadLine();
	    line.Trim();
	    if (!line.IsEmpty()) {
		wxLogWarning("%s", line);
		had_errors = true;
	    }
	}
	if (had_errors) {
	    wxLogError(_("Errors encountered during virus signature install"));
	}
    }
    delete m_siginst_process;

    m_panel_sigman->Enable();
}
Пример #4
0
void Instance::OnInstProcExited(wxProcessEvent& event)
{
	m_running = false;
	printf("Instance exited with code %i.\n", event.GetExitCode());
	if (evtHandler != NULL)
	{
		evtHandler->AddPendingEvent(event);
	}
}
Пример #5
0
void PipedProcessCtrl::OnEndProcess(wxProcessEvent &event)
{
    m_exitcode=event.GetExitCode();
    SyncOutput(-1); //read any left over output TODO: while loop to handle extremely large amount of output
    m_dead=true;
    delete m_proc;
    m_proc=NULL;
    m_killlevel=0;
    if(m_shellmgr)
        m_shellmgr->OnShellTerminate(this);
}
Пример #6
0
void mxConsole::OnProcessTerminate( wxProcessEvent &event ) {
    if (event.GetPid()==the_process_pid) {
        GetProcessOutput(false);
        want_input=false;
        Refresh();
        the_process->Detach();
        the_process=NULL;
        timer_process->Stop();
        parent->OnProcessTerminated();
    }
}
void AsyncExeCmd::ProcessEnd(wxProcessEvent& event)
{
	//read all input before stopping the timer
	if( !m_stop ){
		PrintOutput();
	}
	
	m_timer->Stop();
	m_busy = false;
	m_stop = false;

	SendEndMsg(event.GetExitCode());
}
Пример #8
0
void
job_run_dialog::on_end_process(wxProcessEvent &evt) {
  process_input();

  int ndx         = jobs_to_start[current_job];
  int exit_code   = evt.GetExitCode();
  bool remove_job;
  wxString status;

  if (abort) {
    jobs[ndx].status = JOBS_ABORTED;
    status           = Z("aborted");
    remove_job       = false;
  } else if (0 == exit_code) {
    jobs[ndx].status = JOBS_DONE;
    status           = Z("completed OK");
    remove_job       = CJAR_NEVER != mdlg->options.clear_job_after_run_mode;
  } else if (1 == exit_code) {
    jobs[ndx].status = JOBS_DONE_WARNINGS;
    status           = Z("completed with warnings");
    remove_job       = (CJAR_ALWAYS == mdlg->options.clear_job_after_run_mode) || (CJAR_WARNINGS == mdlg->options.clear_job_after_run_mode);
  } else {
    jobs[ndx].status = JOBS_FAILED;
    status           = Z("failed");
    remove_job        = CJAR_ALWAYS == mdlg->options.clear_job_after_run_mode;
  }

  jobs[ndx].finished_on = wxGetUTCTime();

  add_to_log(wxString::Format(Z("Finished job ID %d on %s: status '%s'"), jobs[ndx].id, format_date_time(jobs[ndx].finished_on).c_str(), status.c_str()));

  if (remove_job) {
    jobs.erase(jobs.begin() + ndx, jobs.begin() + ndx + 1);
    for (auto idx = 0u; jobs_to_start.size() > idx; ++idx)
      if (jobs_to_start[idx] >= ndx)
        jobs_to_start[idx]--;
  }

  mdlg->save_job_queue();
  delete process;
  process = nullptr;
  out     = nullptr;

  wxRemoveFile(opt_file_name);

  if (!abort)
    g_jobs->SetValue((current_job + 1) * 100);

  start_next_job();
}
Пример #9
0
void wxLuaDebuggerBase::OnEndDebugeeProcess(wxProcessEvent& event)
{
    //wxPrintf(wxT("OnEndDebugeeProcess the m_debuggeeProcess %p %d exists %d\n"), m_debuggeeProcess, m_debuggeeProcessID, wxProcess::Exists(m_debuggeeProcessID)); fflush(stdout);

    // The process's OnTerminate will null m_debuggeeProcess,
    // but if in destructor it's already NULL and don't send event.
    if (m_debuggeeProcess != NULL)
    {
        wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_EXIT, this);
        debugEvent.SetMessage(wxString::Format(wxT("Process (%d) ended with exit code : %d"), event.GetPid(), event.GetExitCode()));
        wxPostEvent(this, debugEvent);
    }

    event.Skip();
}
Пример #10
0
void MyProcessOutput::OnTerminate(wxProcessEvent &event)
{
    m_wakeup.Stop();
    // show all output
    while (processInput()) {}

    int exit = event.GetExitCode();
    delete m_process;
    m_process = 0;

    m_cancel_process->SetLabel(_("&Close window"));
    wxString msg;
    msg << _("Freshclam exited with code: ") << exit;
    m_logoutput->Append(msg);
}
Пример #11
0
void MainWindow::OnFRED2Exited(wxProcessEvent &event) {
	if ( this->FRED2_pid == 0 ) {
		wxLogError(_T("OnFRED2Exited called before there is a process running"));
		return;
	}

	int exitCode = event.GetExitCode();

	wxLogInfo(_T("FRED2 Open exited with a status of %d"), exitCode);

	delete this->process;
	this->process = NULL;
	this->FRED2_pid = 0;
	
	wxButton* fred = dynamic_cast<wxButton*>(
		wxWindow::FindWindowById(ID_FRED_BUTTON, this));
	wxCHECK_RET(fred != NULL, _T("Unable to find FRED button"));
	fred->SetLabel(_T("FRED"));
	fred->Enable();
}
Пример #12
0
void PreviewDlg::OnEndProcess(wxProcessEvent& event) {
	m_thread = NULL;
	if (event.GetExitCode() == -1) return;

	RefreshBrowser(cxUPDATE_REFRESH);
}
void frmRestore::OnEndProcess(wxProcessEvent& ev)
{
    ExternProcessDialog::OnEndProcess(ev);

    if (done && viewRunning && !ev.GetExitCode())
    {
        done = false;

        wxString str=wxTextBuffer::Translate(txtMessages->GetValue(), wxTextFileType_Unix);

        wxStringTokenizer line(str, wxT("\n"));
        line.GetNextToken();
        
        wxBeginBusyCursor();

        wxString i18nbackup = _("Backup");
        wxTreeItemId root = ctvObjects->AddRoot(i18nbackup + wxT(" ") + txtFilename->GetValue());
        wxString currentSchema = wxT("");
        wxTreeItemId currentSchemaNode;
        wxTreeItemId schemaNode, lastItem;
        wxTreeItemIdValue schemaNodeData;
        numberOfTOCItems = 0;

        while (line.HasMoreTokens())
        {
            // Read the next line
            str=line.GetNextToken();

            // Skip the few lines of comments
            if (str.Left(1) == wxT(";") || str.Left(1) == wxT("P"))
                continue;

            // Split the line according to spaces
            wxStringTokenizer col(str, wxT(" "));

            // Column 1 (dumpId)
            col.GetNextToken();

            // Column 2 (tableOid)
            col.GetNextToken();

            // Column 3 (oid)
            col.GetNextToken();

            // Column 4 (desc)
            // First interesting information: object's type
            wxString type=col.GetNextToken();

            if (type == wxT("PROCEDURAL"))
            {
                // type for a PL is PROCEDURAL LANGUAGE
                // we'll keep the next column for the object's type
                type = col.GetNextToken();
            }
            else if (type == wxT("SHELL"))
            {
                // type for a SHELL is SHELL TYPE
                // we'll keep both columns for the object's type
                type += col.GetNextToken();
            }
            else if (type == wxT("OPERATOR"))
            {
                // type for an operator class is OPERATOR CLASS
                // we'll keep the two columns for the object's type
                wxString tmp = str.Mid(str.Find(type)+type.Length()+1, 5);
                if (tmp == wxT("CLASS"))
                    type += wxT(" ") + col.GetNextToken();
            }
            else if (type == wxT("SEQUENCE"))
            {
                // type for a sequence can be SEQUENCE, SEQUENCE OWNED BY or SEQUENCE SET
                // we'll keep all these columns for the object's type
                wxString tmp = str.Mid(str.Find(type)+type.Length()+1, 3);
                if (tmp == wxT("OWN") || tmp == wxT("SET"))
                {
                    type += wxT(" ") + col.GetNextToken();
                    if (type == wxT("SEQUENCE OWNED"))
                        type += wxT(" ") + col.GetNextToken();
                }
            }
            else if (type == wxT("FK"))
            {
                // type for a FK is FK CONSTRAINT
                // we'll keep the next column for the object's type
                type = col.GetNextToken();
            }
            else if (type == wxT("TABLE"))
            {
                if (col.CountTokens() == 4)
                {
                    // TABLE DATA detected
                    type += wxT(" ") + col.GetNextToken();
                }
            }

            // Column 5 (namespace)
            // Second interesting information: object's schema
            wxString schema=col.GetNextToken();

            // Column 6 (tag)
            // Third interesting information: object's qualified name
            //wxString name=col.GetNextToken();
            wxString name = str.Mid(str.Find(schema)+schema.Length()+1).BeforeLast(' ');

            // Column 7 (owner)
            // Fourth interesting information: object's owner
            wxString owner = str.Mid(str.Find(name)+name.Length()+1);

            // New method
            if (type == wxT("LANGUAGE"))
            {
                lastItem = ctvObjects->AppendItem(root, wxT("Language ")+name+wxT(" [") + _("owner") + wxT(": ")+owner+wxT("]"), 1);
            }
            else if (type == wxT("ACL") && schema == wxT("-"))
            {
                lastItem = ctvObjects->AppendItem(root, type+wxT(" ")+name, 1);
            }
            else if (type == wxT("CAST"))
            {
                lastItem = ctvObjects->AppendItem(root, name, 1);
            }
            else if (type == wxT("SCHEMA"))
            {
                currentSchema = name;
                lastItem = currentSchemaNode = ctvObjects->AppendItem(root, wxT("Schema ")+name, 1);
            }
            else
            {
                if (schema != currentSchema)
                {
                    // Loop through the nodes to find the schema
                    schemaNode = ctvObjects->GetFirstChild(root, schemaNodeData);
                    bool found = false;
                    while (schemaNode.IsOk() && !found)
                    {
                        if (ctvObjects->GetItemText(schemaNode) == wxT("Schema ")+schema)
                            found=true;
                        else
                            schemaNode = ctvObjects->GetNextChild(root, schemaNodeData);
                    }

                    // Found it?
                    if (schemaNode.IsOk())
                    {
                        currentSchema = schema;
                        currentSchemaNode = schemaNode;
                    }
                    // if we are treating a comment, we use the schema of its
                    // object (ie, the previous line)
                    else if (type != wxT("COMMENT"))
                        wxLogError(_("Schema node not found for object ") + type+wxT(" ")+name+wxT(" [")+_("owner")+wxT(": ")+owner+wxT("]"));
                }
                lastItem = ctvObjects->AppendItem(currentSchemaNode, type+wxT(" ")+name+wxT(" [")+_("owner")+wxT(": ")+owner+wxT("]"), 1);
            }
            ctvObjects->SetItemData(lastItem, new restoreTreeItemData(numberOfTOCItems,str));
            numberOfTOCItems++;
        }

        wxEndBusyCursor();
        nbNotebook->SetSelection(3);
    }
    else
    {
        wxRemoveFile(restoreTOCFilename);
    }
}
Пример #14
0
int bmx_wxprocessevent_getexitcode(wxProcessEvent & event) {
	return event.GetExitCode();
}
Пример #15
0
int bmx_wxprocessevent_getpid(wxProcessEvent & event) {
	return event.GetPid();
}
Пример #16
0
void mxOutputView::OnProcessTerminate(wxProcessEvent &evt) {
	OnProcessTerminateCommon(evt.GetExitCode());
	delete process;
	process=nullptr;
}