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. QProcess readAll()

QProcess readAll()

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.4k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jocala
    wrote on last edited by
    #1

    I'm qorking with QProcess and have a roadblock reading output:

    this first routine works: I get content in the QString I can query:

    @
    void start_server()
    {
    QProcess *start_adb=new QProcess;
    start_adb->start(adbfile + " start-server");
    start_adb->waitForFinished(-1);
    command=start_adb->readAll();
    delete start_adb;

     if (command.contains("daemon started successfully"))
         serverRunning = true;
         else
         serverRunning = false;
    

    }
    @

    The QString returns empty in the routine below:

    @
    if (!fileName.isEmpty() )
    {

    QMessageBox::StandardButton reply;
      reply = QMessageBox::question(this, "Install", "Install "+fileName+"?",
                                    QMessageBox::Yes|QMessageBox::No);
      if (reply == QMessageBox::Yes)
      {
          QProcess *install_apk=new QProcess;
          install_apk->start(adbfile + " install -r" + fileName);
          install_apk->waitForFinished(-1);
          command=install_apk->readAll();
          delete install_apk;
          }
    
    if (command.contains("failed"))
         install_failed  = true;
         else
         install_failed = false;
    

    }

    }

    @

    I can run this command manually and get output succeed or fail.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jocala
      wrote on last edited by
      #2

      Oops! The command I build was malformed.

      This line:

      @
      install_apk->start(adbfile + " install -r" + fileName);
      @

      should be:

      @
      install_apk->start(adbfile + " install -r " + fileName);
      @

      Fixed.

      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