Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess kill multiple scripts
Qt 6.11 is out! See what's new in the release blog

QProcess kill multiple scripts

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 445 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.
  • A Offline
    A Offline
    adwsf
    wrote on last edited by
    #1

    I use QProcess to start a shell script a, and script a starts script b. When QProcess sends a kill signal, it can only stop script a. Is there any good way to stop script b at the same time?

    JonBJ 1 Reply Last reply
    0
    • A adwsf

      I use QProcess to start a shell script a, and script a starts script b. When QProcess sends a kill signal, it can only stop script a. Is there any good way to stop script b at the same time?

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

      @adwsf
      The Qt QProcess only know about script A, it has no idea that script has started a script B. So the only proper way is for script A to either kill script B when script A is about to be killed or (better) to ensure that when script A is killed the OS will in turn kill script B since A is its parent.

      Since you say nothing about your platform or how scripts run each other nobody knows what the situation is. You won't be able to have script A act on receiving a SIGKILL, so if you want to take the first route you would be better using QProcess:terminate() than QProcess::kill(). Otherwise you are looking for solutions like killing process groups.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adwsf
        wrote on last edited by
        #3

        @JonB thanks.

        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