Menu
  • HOME
  • TAGS

Attempting to read stdout from spawned QProcess

qt,signals-slots,qprocess

Issue is in statement QObject::connect(console_backend, SIGNAL(console_backend ->readyReadStandardOutput()), this, SLOT(this->receiveConsoleBackendOutput())); It should be QObject::connect(console_backend, SIGNAL(readyReadStandardOutput()), this, SLOT(receiveConsoleBackendOutput())); ...

Qt5, symbolic link to a folder

c++,windows,qt,qprocess,qfile

I found out that it cannot be done in Qt, so I ended up using the Win32 API instead. Specifically the CreateSymbolicLink() function.

How to execute a php script in Qt?

php,qt,qprocess

So if php is not found in the path, or didn't get loaded into the environment variables that QProcess is using, you could get an error like that. Try printing out the environment variables: qDebug() << "Process Environment" << myProcess.getProcessEnvironment().toStringList(); If under the PATH variable it doesn't mention the location...

Qt QProcess read ssh verbose output

c++,qt,ssh,qtcore,qprocess

I do not think this is possible off-hand with stock Qt, but e.g. you could poll with a certain interval if the ssh session is still running. In that case, pgrep is your friend.

Error while running a .sh script via QProcess

qt,shell,qt4,qprocess

It looks strange that you are using external script to update database! why you don't pass "ora_exported.csv" file name as a script argument? This would help solve the problem. I was talking (typing) about this solution: void MainWindow::on_importButton_clicked() { QProcess::startDetached("/bin/sh", QStringList()<<"/home/aj/script.sh", "<location of: 'ora_exported.csv' file>"); } ...

What is the difference between QProcess::start and QProcess::startDetached?

c++,qt,qprocess

If you use start, termination of the caller process will case the termination of the called process as well. If you use startDetached, after the caller is terminated, the child will continue to live. For example: QProcess * p = new QProcess(); p->start("some-app"); delete p;// <---some-app will be terminated QProcess...

How to debug PyQt crashes?

python,multithreading,pyqt,qprocess

Looks like this thread crashed. Thread 4 Crashed:: Uci_engine 0 libsystem_kernel.dylib 0x00007fff8e18e866 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff8c7a335c pthread_kill + 92 2 libsystem_c.dylib 0x00007fff91b34b1a abort + 125 3 libsystem_malloc.dylib 0x00007fff876b5451 realloc + 364 4 QtCore 0x00000001094762dd QByteArray::realloc(int) + 161 This thread crashed caused the whole program crashed and exit. From...

What's the difference between QProcess::kill() and QProcess::terminate()?

c++,qt,difference,qprocess

Dunno what's not clear if you have written: void QProcess::kill() Kills the current process, causing it to exit immediately. On Windows, kill() uses TerminateProcess, and on Unix and OS X, the SIGKILL signal is sent to the process. http://doc.qt.io/qt-5/qprocess.html#kill void QProcess::​terminate() Attempts to terminate the process. The process may not...

Running external executable in Qt using QProcess

c++,qt,qprocess

Check in the main() -function that a.txt -file really exists and is open before writing to it. Check in the Qt that the "program" -file really exists before executing it. Return different result codes from the main() -function and check the result in Qt: QProcess *proc = new QProcess(); proc->start(program);...

How to use QProcess in headless script?

python,qt,pyqt,pyside,qprocess

You need to wait for the process to finish before you allow the script to exit: p.start("./mainapp.exe", []) p.waitForFinished() out = p.readAllStandardOutput() ...

How to execute command like “qmake -v > 1.txt” from a specific folder with QProcess?

c++,qt,qprocess,qtcore,qfile

I think you are looking for this method: void QProcess::setStandardOutputFile(const QString & fileName, OpenMode mode = Truncate) You would be using it then like this: QProcess myProcess; myProcess.setStandardOutputFile("1.txt"); myProcess.start("qmake -v"); myProcess.waitForFinished(); You could also read the output into the application and write that out with QFile. This may get you...

Running another Qt based app with QProcess (runs non Qt based programs just fine)

c++,qt,qprocess

I could not figure out why I could not open App2 with QProcess but I figured out that I can open it with the open command which is called by QProcess.

How to execute complex linux commands in Qt? [duplicate]

c++,linux,qt,shell,qprocess

The key methods that exist for this purpose established in QProcess: void QProcess::setProcessChannelMode(ProcessChannelMode mode) and void QProcess::setStandardOutputProcess(QProcess * destination) Therefore, the following code snippet would be the equivalence of command1 | command2 without limiting yourself to one interpreter or another: QProcess process1 QProcess process2; process1.setStandardOutputProcess(&process2); process1.start("echo myPass"); process2.start("sudo -S shutdown...

QProcess: not receiving finished() signal running Powershell script

powershell,qt5,qprocess

I found the solution. Apparently Powershell does not run in the same way from the console or when is called from another program (noninteractive). If I add at end of ps_excel.ps1 script: Get-Process Powershell | Stop-Process instead of exit 0 I Stop really Powershell and get finished signal, with QProcess::ExitStatus...

QProcess Mac OS , Cant launch executable with arguments

osx,qprocess,yosemite

... process->start("open \""+program); process->setArguments(args); As you're setting the arguments after you call QProcess::start, the process will not receive the arguments when launching your desired program. As the documentation for QProcess::setArguments states Set the arguments to pass to the called program when starting the process. This function must be called before...

QProcess::execute(“clear”) Issue

c++,linux,qt,qt-creator,qprocess

The code below works fine for me. Please make sure that the clear command works fine in your console first. main.cpp #include <QProcess> #include <QDebug> int main() { QProcess::execute("clear"); qDebug() << QProcessEnvironment::systemEnvironment().contains("TERM"); return 0; } main.pro TEMPLATE = app TARGET = main QT = core SOURCES += main.cpp Build and...

Pyside: Multiple QProcess output to TextEdit

python,pyside,signals-slots,qprocess

Connect the signal using a lambda so that the relevant process is passed to the slot: p.readyReadStandardOutput.connect( lambda process=p: self.write_process_output(process)) def write_process_output(self, process): self.viewer.text_edit.append(process.readAllStandardOutput()) ...

Starting 7zip from QProcess gives error “cannot find archive”

qt,path,7zip,qprocess

Since Kamil didn't answer, I give it myself: The correct way to call 7zip is 7za.exe x -y "-oD:\Projects\ExtractTest\build-Verpacker2-Desktop_Qt_5_3_MSVC2013_OpenGL_32bit-Debug\BlaBla" "C:\Users\JanS\AppData\Local\Temp\eci2002win.zip" 7zip does not like the " after the -o....

QProcess Set Environment Variables for startDetached

qt,qtcore,qprocess

As child process inherits the environment from the parent, I think that the easiest workaround is to save/modify/restore own environment using qgetenv() and qputenv() before and after QProcess::startDetached() call.

Qt - output of processes all written at once in TextEdit

qt,qprocess

Your loop blocks Qt's event loop which is why the GUI is not updating. You could use QCoreApplication::processEvents() once per loop iteration to update the GUI: for (int i = 0; i < numberOfTests; i++){ ... this->runningToolProcess->waitForFinished(); QCoreApplication::processEvents(); } Alternatively you could start the next process in your processFinished() slot....

Isn't the line QProcess *p redundant?

c++,qt,qprocess,redundancy,qt5.4

It is useful for code portability, or when matching an example. Say you find an example that uses QProcess * p for 100 lines, and then you apply it to a vector of processes, readability suffers when you swap out p for (*iter) in each location... but if you assign...

Qt avoid warning 'QProcess: destroyed while process still running

c++,qt,qtcore,qprocess

You can kill or terminate the process explicitly depending on your desire. That is, however, not enough on its own because you actually need to wait for the process to terminate. "kill" means it will send the SIGKILL signal on Unix to the process and that also takes a bit...

Launching a shell script when Button Pressed on GUI made with Qt

c++,linux,qt,shell,qprocess

You could make it either blocking or non-blocking. It depends on whether you would like to block your main process or run the shell script in the background in an async mode. Also, since you do not need the output, you do not even need to instantiate here, just use...

QProcess() doesn't always work

c++,linux,qt,qprocess

The documentation is not very clear about this, but it looks like readAll has the same output as readAllStandardOutput. Software typically outputs errors on stderr (StandardError), so you would have to call readAllStandardError to see the error message. So there is nothing wrong with QProcess(), it is just mkfs.fat which...