X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5a8561fc558ea72a5350e7aed98c04443af2874e..f2b7492a88eef36f26668cefff8d3f8b91e5f50e:/samples/exec/exec.cpp diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index 64d1aae2b5..c871883726 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -53,6 +53,7 @@ #include "wx/numdlg.h" #include "wx/textdlg.h" #include "wx/ffile.h" +#include "wx/stopwatch.h" #include "wx/process.h" @@ -727,6 +728,15 @@ void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) { + if ( !m_cmdLast ) + { +#ifdef __WXMSW__ + m_cmdLast = "type Makefile.in"; +#else + m_cmdLast = "cat -n Makefile"; +#endif + } + wxString cmd = wxGetTextFromUser(_T("Enter the command: "), DIALOG_TITLE, m_cmdLast); @@ -753,13 +763,15 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) if ( sync ) { - wxLogStatus( _T("'%s' is running please wait..."), cmd.c_str() ); + wxLogStatus("\"%s\" is running please wait...", cmd); + + wxStopWatch sw; wxArrayString output, errors; int code = wxExecute(cmd, output, errors); - wxLogStatus(_T("Command '%s' terminated with exit code %d."), - cmd.c_str(), code); + wxLogStatus("Command \"%s\" terminated after %ldms; exit code %d.", + cmd, sw.Time(), code); if ( code != -1 ) {