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. Qthread

Qthread

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 193 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.
  • S Offline
    S Offline
    satyanarayana143
    wrote on last edited by
    #1

    i am running Qprocess in Qthread it is not executing can any body tell what is happening .Below is my code .

    This code is in thread

    QProcess *process = new QProcess();
    process->start("sh",QStringList() << "du");
    process->waitForFinished();

    JonBJ 1 Reply Last reply
    0
    • S satyanarayana143

      i am running Qprocess in Qthread it is not executing can any body tell what is happening .Below is my code .

      This code is in thread

      QProcess *process = new QProcess();
      process->start("sh",QStringList() << "du");
      process->waitForFinished();

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

      @satyanarayana143
      Forget about threads. (I don't know if you even need a thread, QProcess running is asynchronous, you probably do not need any thread, but that's another matter.)

      process->start("sh",QStringList() << "du");
      

      I don't know what you expect this to do, but there is a fair chance it is incorrect. You should test exactly this command in a terminal and see what you get. In code you must read from standard error at minimum after trying to execute a command because 90% of the time people say "my command is not working" it turns out a message is being output there. See e.g. https://doc.qt.io/qt-5/qprocess.html#readAllStandardError. You should also always slot onto https://doc.qt.io/qt-5/qprocess.html#errorOccurred.

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved