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. Custom command during stop - Qt Creator

Custom command during stop - Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kumararajas
    wrote on last edited by
    #1

    Hello,

    When I run the application from Qt creator, since I have rightly mentioned the path for the executable, application runs successfully.

    Few questions -

    1. My application needs sudo permission to build. I don't know where to mention "sudo".
    2. My application needs sudo permission to run. Not sure on how to specify.

    For these two, I have a way to overcome - Start the Qt Creator with "sudo" permission. Any other smart ways?

    1. This is tricky. When I stop the application from Qt creator. I am sure that it would send "kill" signal and kill the application. Whereas, In my case, I need to pass some flags as well during the kill command being executed.
      How to achieve this?

    Thanks,
    Kumara

    --Kumar

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i am by far not a linux guru, but wouldn't it help to start QtCreator already with "sudo"?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kumararajas
        wrote on last edited by
        #3

        Hi,

        When I start the Qt Creator with sudo, yes it helps me in building and running the application.

        In case of stop or kill, I need to pass some arguments to the kill command. How to do that?

        --Kumar

        jsulmJ 1 Reply Last reply
        0
        • K kumararajas

          Hi,

          When I start the Qt Creator with sudo, yes it helps me in building and running the application.

          In case of stop or kill, I need to pass some arguments to the kill command. How to do that?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kumararajas Why do you need sudo to build your application?
          What parameters do you want to pass to your application if you stop it?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply
          0
          • jsulmJ jsulm

            @kumararajas Why do you need sudo to build your application?
            What parameters do you want to pass to your application if you stop it?

            K Offline
            K Offline
            kumararajas
            wrote on last edited by
            #5

            @jsulm
            Why do you need sudo to build your application?

            My application uses system resources such as message queues, which needs sudo permission for my application to access them.

            What parameters do you want to pass to your application if you stop it?

            My application creates many child processes. When I want to kill my application, I need to shutdown the child process safely. So I need to pass -15 for the kill command.

            Example, sudo pkill -15 "MyApp", this will help the child process the shutdown cleanly and release all the resources.

            --Kumar

            jsulmJ 1 Reply Last reply
            0
            • K kumararajas

              @jsulm
              Why do you need sudo to build your application?

              My application uses system resources such as message queues, which needs sudo permission for my application to access them.

              What parameters do you want to pass to your application if you stop it?

              My application creates many child processes. When I want to kill my application, I need to shutdown the child process safely. So I need to pass -15 for the kill command.

              Example, sudo pkill -15 "MyApp", this will help the child process the shutdown cleanly and release all the resources.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @kumararajas
              "My application uses system resources such as message queues, which needs sudo permission for my application to access them." - that's on runtime. Why do you need sudo to BUILD your app?

              You can use a signal handler in your app, see "man sigaction" (not Qt related).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              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