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. Can't get QProcess to work.. using cygwin and rsync

Can't get QProcess to work.. using cygwin and rsync

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 2 Posters 1.3k 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.
  • R roygual

    Hello

    I'm trying to execute a rsync from cygwin, just for start playing with qprocess
    bassing my code on Qt example, it runs but it does notting at all

    pretty sure is something simple I don't understand, I'm stuck

       QString program = "cygwin64/rsync.exe";
       QStringList arguments;
       arguments <<"-rtvu"<< "cygdrive/C/path/to/folder/" << "cygdrive/X/path/to/folder/";
    
       QProcess *myProcess = new QProcess();
       myProcess->start(program, arguments);
    

    I made one string with "program" and "arguments" to see what is passed to Qt then copied & paste and works just fine on windows terminal.

    investigating through the web, the examples and explanations shown by other people doesn't seem to work with me.

    thank you in advance

    P.D.
    Qtcreator 7.0
    Qt 6.3.0
    Toolkit msvc2019 (Visual studio 2022 community)
    Windows 11 pro (with latest updates)

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

    @roygual
    You should check for errors, and more particularly read anything from stderr/stdout.

    You are using a relative path to the executable, cygwin64/rsync.exe. How do you know what the current directory is, and whether it can find that?

    and works just fine on windows terminal

    Depends what the current directory was.

    R 4 Replies Last reply
    0
    • JonBJ JonB

      @roygual
      You should check for errors, and more particularly read anything from stderr/stdout.

      You are using a relative path to the executable, cygwin64/rsync.exe. How do you know what the current directory is, and whether it can find that?

      and works just fine on windows terminal

      Depends what the current directory was.

      R Offline
      R Offline
      roygual
      wrote on last edited by
      #3
      This post is deleted!
      R 1 Reply Last reply
      0
      • R roygual

        This post is deleted!

        R Offline
        R Offline
        roygual
        wrote on last edited by roygual
        #4
        This post is deleted!
        1 Reply Last reply
        0
        • JonBJ JonB

          @roygual
          You should check for errors, and more particularly read anything from stderr/stdout.

          You are using a relative path to the executable, cygwin64/rsync.exe. How do you know what the current directory is, and whether it can find that?

          and works just fine on windows terminal

          Depends what the current directory was.

          R Offline
          R Offline
          roygual
          wrote on last edited by roygual
          #5
          This post is deleted!
          1 Reply Last reply
          0
          • JonBJ JonB

            @roygual
            You should check for errors, and more particularly read anything from stderr/stdout.

            You are using a relative path to the executable, cygwin64/rsync.exe. How do you know what the current directory is, and whether it can find that?

            and works just fine on windows terminal

            Depends what the current directory was.

            R Offline
            R Offline
            roygual
            wrote on last edited by roygual
            #6
            This post is deleted!
            1 Reply Last reply
            0
            • JonBJ JonB

              @roygual
              You should check for errors, and more particularly read anything from stderr/stdout.

              You are using a relative path to the executable, cygwin64/rsync.exe. How do you know what the current directory is, and whether it can find that?

              and works just fine on windows terminal

              Depends what the current directory was.

              R Offline
              R Offline
              roygual
              wrote on last edited by
              #7

              @JonB
              it was just a bunch of little mistakes typical of an amateur like me

              here de correct and working code

              QStringList arguments;
              
              arguments <<"-r"<<"/cygdrive/x/Users/Roy/Desktop/uno/"<<"/cygdrive/x/Users/Roy/Desktop/dos/";
              
              QProcess *myProcess = new QProcess();
              myProcess->start("cygwin64/rsync.exe", arguments);
              
              
              myProcess->waitForFinished(-1);
              QString out = myProcess->readAllStandardOutput();
              QString error = myProcess->readAllStandardError();
              qDebug()<<out;
              qDebug()<<error;
              

              Thank you very much for your help!!

              JonBJ 1 Reply Last reply
              0
              • R roygual

                @JonB
                it was just a bunch of little mistakes typical of an amateur like me

                here de correct and working code

                QStringList arguments;
                
                arguments <<"-r"<<"/cygdrive/x/Users/Roy/Desktop/uno/"<<"/cygdrive/x/Users/Roy/Desktop/dos/";
                
                QProcess *myProcess = new QProcess();
                myProcess->start("cygwin64/rsync.exe", arguments);
                
                
                myProcess->waitForFinished(-1);
                QString out = myProcess->readAllStandardOutput();
                QString error = myProcess->readAllStandardError();
                qDebug()<<out;
                qDebug()<<error;
                

                Thank you very much for your help!!

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

                @roygual said in Can't get QProcess to work.. using cygwin and rsync:

                myProcess->start("cygwin64/rsync.exe", arguments);

                I still say: How do you know what the current working directory is when your program is run for it to find the executable via a relative path cygwin64/rsync.exe? If, say, you cd \windows before running your Qt application or "copied & paste and works just fine on windows terminal" what happens?

                Your final code "leaks" the QProcess from QProcess *myProcess = new QProcess();.

                R 1 Reply Last reply
                1
                • JonBJ JonB

                  @roygual said in Can't get QProcess to work.. using cygwin and rsync:

                  myProcess->start("cygwin64/rsync.exe", arguments);

                  I still say: How do you know what the current working directory is when your program is run for it to find the executable via a relative path cygwin64/rsync.exe? If, say, you cd \windows before running your Qt application or "copied & paste and works just fine on windows terminal" what happens?

                  Your final code "leaks" the QProcess from QProcess *myProcess = new QProcess();.

                  R Offline
                  R Offline
                  roygual
                  wrote on last edited by roygual
                  #9

                  @JonB

                  My idea is to move the program folder one place to another, portable; copy the app folder to one computer to another or move it with a thumbdrive the cygwin64 folders is in the app folder and next to the executable ,
                  to my understand this path always start from the executable is, .. is "relative" to the executable

                  cd \windows and copy/paste to other locations, even on usb, double click or terminal.. works.

                  I'm a total novice, if I'm doing a bad practice I would be very grateful if you correct me.

                  talking about bad practices

                  QProcess *myProcess = new QProcess(this);
                  
                  JonBJ 1 Reply Last reply
                  0
                  • R roygual

                    @JonB

                    My idea is to move the program folder one place to another, portable; copy the app folder to one computer to another or move it with a thumbdrive the cygwin64 folders is in the app folder and next to the executable ,
                    to my understand this path always start from the executable is, .. is "relative" to the executable

                    cd \windows and copy/paste to other locations, even on usb, double click or terminal.. works.

                    I'm a total novice, if I'm doing a bad practice I would be very grateful if you correct me.

                    talking about bad practices

                    QProcess *myProcess = new QProcess(this);
                    
                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #10

                    @roygual said in Can't get QProcess to work.. using cygwin and rsync:

                    cd \windows and copy/paste to other locations, even on usb, double click or terminal.. works.

                    I don't understand since you show you are running executable via relative path cygwin64/rsync.exe. But that works for you somehow.

                    R 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @roygual said in Can't get QProcess to work.. using cygwin and rsync:

                      cd \windows and copy/paste to other locations, even on usb, double click or terminal.. works.

                      I don't understand since you show you are running executable via relative path cygwin64/rsync.exe. But that works for you somehow.

                      R Offline
                      R Offline
                      roygual
                      wrote on last edited by
                      #11

                      @JonB
                      Hello
                      Tested on a second PC win11, with Qt installed but did not build or used with qtcreator, .... copied the folder to desktop and run the binary with double click... still working fine.

                      I'll test with win 10 on other pc.

                      regards

                      JonBJ 1 Reply Last reply
                      0
                      • R roygual

                        @JonB
                        Hello
                        Tested on a second PC win11, with Qt installed but did not build or used with qtcreator, .... copied the folder to desktop and run the binary with double click... still working fine.

                        I'll test with win 10 on other pc.

                        regards

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #12

                        @roygual
                        It's nothing to do with how you build or what machine you test it on. It's: how is windows locating the relative path cygwin64/rsync.exe you either span from your Qt program or type into a Command Prompt, without relying on whatever the current directory happens to be?

                        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