Russian Qt Forum
Сентябрь 28, 2024, 20:21 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: QProcess - как определить что завершился без ошибок?  (Прочитано 6186 раз)
spectre71
Гость
« : Август 17, 2009, 12:46 »

QProcess::ExitStatus QProcess::error ()
При нормальном завершени устанавливается в QProcess::UnknownError!
Получается что определить, что процесс нормально завершился невозможно?

Цитировать
enum QProcess::ProcessError

This enum describes the different types of errors that are reported by QProcess.

Constant   Value   Description
QProcess::FailedToStart   0   The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.
QProcess::Crashed   1   The process crashed some time after starting successfully.
QProcess::Timedout   2   The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.
QProcess::WriteError   4   An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.
QProcess::ReadError   3   An error occurred when attempting to read from the process. For example, the process may not be running.
QProcess::UnknownError   5   An unknown error occurred. This is the default return value of error().
Записан
Rcus
Гость
« Ответ #1 : Август 17, 2009, 13:03 »

Цитировать
int QProcess::exitCode () const

Returns the exit code of the last process that finished.

QProcess::ExitStatus QProcess::exitStatus () const

Returns the exit status of the last process that finished.

On Windows, if the process was terminated with TerminateProcess() from another application this function will still return NormalExit unless the exit code is less than 0.

This function was introduced in Qt 4.1.
Записан
spectre71
Гость
« Ответ #2 : Август 17, 2009, 13:18 »

Видимо я не совсем понятно написал.
Меня интересует как различить 4 варианта завершения процесса
1) Не запустился. Это отслеживается просто -  if(Process.error() == QProcess::FailedToStart) {...}
2) Завершился корректно с exitCode == 0
3) Завершился корректно с exitCode != 0
4) Сдох тем или иным образом
    a) кто-то прибил
    b) или сам сдох Улыбающийся
    Не плохо бы еще разделить (a) и (b), но это не обязательно.

Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.052 секунд. Запросов: 20.