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 emit exit signal too earlier
QtWS25 Last Chance

QProcess emit exit signal too earlier

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 698 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.
  • W Offline
    W Offline
    Wapiti
    wrote on last edited by
    #1

    Hi ! I'm stuck because my process emit a exit signal but my external .exe its already running...
    that's apeared about 1 of 2 time.
    I'm on win10 64bits 8Go ram. I see that don't proc on win8 but I need do this on W10.
    Someone have an idee to fix that ?
    thanks.
    (sorry for my bad english)

    jsulmJ 1 Reply Last reply
    0
    • W Wapiti

      Hi ! I'm stuck because my process emit a exit signal but my external .exe its already running...
      that's apeared about 1 of 2 time.
      I'm on win10 64bits 8Go ram. I see that don't proc on win8 but I need do this on W10.
      Someone have an idee to fix that ?
      thanks.
      (sorry for my bad english)

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

      @Wapiti Please explain better. What process do you mean? Do you start an executable using QProcess? Please show your code.

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

      1 Reply Last reply
      1
      • W Offline
        W Offline
        Wapiti
        wrote on last edited by
        #3

        hum okay sorry.

        QString launcher = "C:/Program Files/D-BOX/Gaming/Assetto Corsa/ACWithLiveMotion.exe";
        QProcess process;
        connect(&process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));
        process.start(launcher, QStringList());
        
        void MainWindow::SessionFinish() {
            qDebug() << "session is finish";
        }
        

        this function is called sometimes before my exe is finish

        jsulmJ 1 Reply Last reply
        0
        • W Wapiti

          hum okay sorry.

          QString launcher = "C:/Program Files/D-BOX/Gaming/Assetto Corsa/ACWithLiveMotion.exe";
          QProcess process;
          connect(&process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));
          process.start(launcher, QStringList());
          
          void MainWindow::SessionFinish() {
              qDebug() << "session is finish";
          }
          

          this function is called sometimes before my exe is finish

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

          @Wapiti said in QProcess emit exit signal too earlier:

          QString launcher = "C:/Program Files/D-BOX/Gaming/Assetto Corsa/ACWithLiveMotion.exe";
          QProcess process;
          connect(&process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));
          process.start(launcher, QStringList());

          Where is this code located? process looks like a local variable.
          You should also connect a slot to https://doc.qt.io/qt-5/qprocess.html#errorOccurred to see whether there is any error.

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

          W 1 Reply Last reply
          2
          • jsulmJ jsulm

            @Wapiti said in QProcess emit exit signal too earlier:

            QString launcher = "C:/Program Files/D-BOX/Gaming/Assetto Corsa/ACWithLiveMotion.exe";
            QProcess process;
            connect(&process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));
            process.start(launcher, QStringList());

            Where is this code located? process looks like a local variable.
            You should also connect a slot to https://doc.qt.io/qt-5/qprocess.html#errorOccurred to see whether there is any error.

            W Offline
            W Offline
            Wapiti
            wrote on last edited by
            #5

            @jsulm
            my process is declared in my .h and initialised in the construtor like this:

            MainWindow::MainWindow(QWidget *parent)
                : QMainWindow(parent)
                , ui(new Ui::MainWindow)
                , socket(new QTcpSocket(this))
                , process(new QProcess(this))
                , isRunning(false)
                , toRestart(false)
            
            {
            

            I already check that, I retry but this connect return :
            0
            QProcess::NormalExit

            jsulmJ 1 Reply Last reply
            0
            • W Wapiti

              @jsulm
              my process is declared in my .h and initialised in the construtor like this:

              MainWindow::MainWindow(QWidget *parent)
                  : QMainWindow(parent)
                  , ui(new Ui::MainWindow)
                  , socket(new QTcpSocket(this))
                  , process(new QProcess(this))
                  , isRunning(false)
                  , toRestart(false)
              
              {
              

              I already check that, I retry but this connect return :
              0
              QProcess::NormalExit

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

              @Wapiti I don't kow what ACWithLiveMotion.exe is doing, but maybe it spawns another process and terminates? Try to start something else via QProcess and see whether you have same issue or not.

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

              W 1 Reply Last reply
              1
              • jsulmJ jsulm

                @Wapiti I don't kow what ACWithLiveMotion.exe is doing, but maybe it spawns another process and terminates? Try to start something else via QProcess and see whether you have same issue or not.

                W Offline
                W Offline
                Wapiti
                wrote on last edited by
                #7

                @jsulm
                It's an app who launch the game Assetto Corsa who's launch by steam with parametter for using material of simulation. I think its a cause of steam execution for launch game where is locate the problem but idk .. sometime it's works succesfully.

                I'm using an other process at an other place and it's works so it's this exe I guess

                JonBJ 1 Reply Last reply
                0
                • W Wapiti

                  @jsulm
                  It's an app who launch the game Assetto Corsa who's launch by steam with parametter for using material of simulation. I think its a cause of steam execution for launch game where is locate the problem but idk .. sometime it's works succesfully.

                  I'm using an other process at an other place and it's works so it's this exe I guess

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

                  @Wapiti
                  It seems likely/possible to me that the .exe merely sets off the game running, but does not wait till it exits?

                  1 Reply Last reply
                  0
                  • JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by JoeCFD
                    #9

                    @Wapiti said in QProcess emit exit signal too earlier:

                    QString launcher = "C:/Program Files/D-BOX/Gaming/Assetto Corsa/ACWithLiveMotion.exe";
                    QProcess process;
                    connect(&process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));
                    process.start(launcher, QStringList());

                    void MainWindow::SessionFinish() {
                    qDebug() << "session is finish";
                    }

                    Are you sure that you did not use local variable?
                    if process is defined in the header, the connection should look like this?
                    connect(process, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(SessionFinish()));

                    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