How to Execute SCP command to transfer files to a target machine
-
@jsulm i mentioned u already that, while debug if i put break point at or in readoutput() that will stop at break point so it means slot is not getting called.
wrote on 16 Nov 2017, 13:18 last edited by@moyin said in How to Execute SCP command to transfer files to a target machine:
that will stop
sorry correction "that will not stop at breakpoint"
-
@moyin said in How to Execute SCP command to transfer files to a target machine:
proc.startDetached(command,params) ;
Hm, startDetached() is a static call, so attaching any signals to it won't work, right? Shouldn't start() be used here instead? Just a thought, I have not analysed this code in-depth.
-
@moyin Then check whether these connects actually were successful:
qDebug() << connect(&proc, SIGNAL(readyReadStandardError()), this, SLOT(readOutput())); qDebug() << connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));
Place a qDebug() in your readOutput() to print something out to see whether the slot is actually called.
wrote on 16 Nov 2017, 13:24 last edited by@jsulm its printing true for both
qDebug() << connect(&proc, SIGNAL(readyReadStandardError()), this, SLOT(readOutput())); qDebug() << connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));``` qDebug() in readOutput() is not printing any thing.
-
@jsulm its printing true for both
qDebug() << connect(&proc, SIGNAL(readyReadStandardError()), this, SLOT(readOutput())); qDebug() << connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));``` qDebug() in readOutput() is not printing any thing.
@moyin This is your problem:
proc.startDetached(command,params) ;
startDetached() is a static method! So you start your process, but it is not managed by the proc instance! Use start() instead:
proc.start(command, params);
-
@moyin This is your problem:
proc.startDetached(command,params) ;
startDetached() is a static method! So you start your process, but it is not managed by the proc instance! Use start() instead:
proc.start(command, params);
-
@moyin In what way failed? Same issue? Slot still not called?
-
@moyin Can you post your current code?
-
wrote on 17 Nov 2017, 08:07 last edited by
@moyin
I'm lost as to where you're at.But at least at one point you were told to use
QProcess::startDetached()
rather thanQProcess:start()
. I believe (untested by me, as usual, could be putting my neck on the line...) that you cannot properly redirect process input/output and/or get signals for input/output if you run the child process detached...? -
@moyin
I'm lost as to where you're at.But at least at one point you were told to use
QProcess::startDetached()
rather thanQProcess:start()
. I believe (untested by me, as usual, could be putting my neck on the line...) that you cannot properly redirect process input/output and/or get signals for input/output if you run the child process detached...?@JNBarchan This was already mentioned, but @moyin says that it isn't working even after changing to start().
There most be still something in the code, that's why I asked for the current code. -
@JNBarchan This was already mentioned, but @moyin says that it isn't working even after changing to start().
There most be still something in the code, that's why I asked for the current code.wrote on 17 Nov 2017, 09:49 last edited by JonB@jsulm
OK, as long he is not tryingstartDetached
that's good...FWIW, I happen to just be working on my own Dialog which spawns a sub-process (
QProcess::start()
), gets its output via signals, and copies it into scrolling text widget, and it's all working fine for me. As one would expect!Purely BTW, given the command is an
scp
whose job is to copy the files, I wonder just what stdout/stderr output he is expecting? Has he informed us whether it's just the output that's missing/empty, or whether the whole command is not running in any case?? -
This post is deleted!