Can't get QProcess to work.. using cygwin and rsync
-
@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.
-
@JonB
it was just a bunch of little mistakes typical of an amateur like mehere 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!!
-
@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, youcd \windows
before running your Qt application or "copied & paste and works just fine on windows terminal" what happens?Your final code "leaks" the
QProcess
fromQProcess *myProcess = new QProcess();
. -
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 executablecd \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);
-
@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. -
-
@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 pathcygwin64/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?