Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Manually emiting errorOcurred
Forum Updated to NodeBB v4.3 + New Features

Manually emiting errorOcurred

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 2 Posters 241 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oarcelus
    wrote on last edited by
    #1

    I am trying to build an scheduler for running several QProcess's in parallel. The executable I am trying to run rarely crashes, but when it does it already handles the divergent cases itself, such that QProcess always sends finished signals with NormalExit status. However, my program must be able to handle these error cases. For that, I connect two slots to the finished signal.

    The first slot reads the standard output of the program, and checks for error messages. If it finds any match, it will emit an errorOcurred singal with a Crashed status.

    The second slots handles the finishing signal. In all cases, the next process in the queue starts. But now I want to send a signal telling the user that a process has finished with Crashed. However, I cannot do this because the processes always finish with NormalExit, and even when emitting the errorOcurred signal in the first slot, trying to recover the Crashed status in the second signal is not possible because when calling error() on the signal sender() I get UnknownError instead of Crashed.

    Does anybody know how to update the processes ProcessError value manually?

    JonBJ 1 Reply Last reply
    0
    • O oarcelus

      I am trying to build an scheduler for running several QProcess's in parallel. The executable I am trying to run rarely crashes, but when it does it already handles the divergent cases itself, such that QProcess always sends finished signals with NormalExit status. However, my program must be able to handle these error cases. For that, I connect two slots to the finished signal.

      The first slot reads the standard output of the program, and checks for error messages. If it finds any match, it will emit an errorOcurred singal with a Crashed status.

      The second slots handles the finishing signal. In all cases, the next process in the queue starts. But now I want to send a signal telling the user that a process has finished with Crashed. However, I cannot do this because the processes always finish with NormalExit, and even when emitting the errorOcurred signal in the first slot, trying to recover the Crashed status in the second signal is not possible because when calling error() on the signal sender() I get UnknownError instead of Crashed.

      Does anybody know how to update the processes ProcessError value manually?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @oarcelus
      Qt at least does not document a way for user to set ProcessError manually, so you can't (unless you find some way examining the source code).

      Your situation is complicated. But in a word it sounds like you should "wrap" your QProcess calls/return results and emit your own signal, perhaps with your own set ProcessError value or other indication to detect whatever your desired situation is.

      O 1 Reply Last reply
      1
      • JonBJ JonB

        @oarcelus
        Qt at least does not document a way for user to set ProcessError manually, so you can't (unless you find some way examining the source code).

        Your situation is complicated. But in a word it sounds like you should "wrap" your QProcess calls/return results and emit your own signal, perhaps with your own set ProcessError value or other indication to detect whatever your desired situation is.

        O Offline
        O Offline
        oarcelus
        wrote on last edited by
        #3

        @JonB Hi, thanks for answering, yes I thought about some custom signals with a QProcess subclass. But then this would assume that the process scheduler knows the specific details about the subclass and it loses a bit of generality. In any case, it looks like this is the way. Thanks again.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved