Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Why Qprocess is not returning output on qt but on command prompt it is working properly?
Forum Updated to NodeBB v4.3 + New Features

Why Qprocess is not returning output on qt but on command prompt it is working properly?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 3 Posters 305 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.
  • Himanshu chardeH Offline
    Himanshu chardeH Offline
    Himanshu charde
    wrote on last edited by
    #1

    process.start("curl -Is https://docs.google.com/forms/d/1DX3werwwT29AHMwjpoqEJjAtWcuHwsS7ruHG2_IJPtbqsaFw/edit");
    process.waitForFinished(-1);

    jsulmJ JonBJ 2 Replies Last reply
    0
    • Himanshu chardeH Himanshu charde

      process.start("curl -Is https://docs.google.com/forms/d/1DX3werwwT29AHMwjpoqEJjAtWcuHwsS7ruHG2_IJPtbqsaFw/edit");
      process.waitForFinished(-1);

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Himanshu-charde

      1. Your start call is wrong: pass the parameters to curl as a QStringList (read documentation)
      2. You're waiting for process to finish - your app will be blocked until the process finishes
      3. How do you read the output of the process in Qt?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • Himanshu chardeH Himanshu charde

        process.start("curl -Is https://docs.google.com/forms/d/1DX3werwwT29AHMwjpoqEJjAtWcuHwsS7ruHG2_IJPtbqsaFw/edit");
        process.waitForFinished(-1);

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

        @Himanshu-charde
        In fact in the case you show I think your process.start("literal string") will work OK, but only because it doesn't happen to have any special characters which need quoting. But @jsulm suggestion to use the separated string list arguments is more robust if that changes.

        The vital thing is that as @jsulm says you are not attempting to read any output from the process back into your Qt app. You'll want https://doc.qt.io/qt-5/qprocess.html#readAllStandardOutput and possibly https://doc.qt.io/qt-5/qprocess.html#readyReadStandardOutput.

        And while you are at it, always do the same for https://doc.qt.io/qt-5/qprocess.html#readAllStandardError. And the https://doc.qt.io/qt-5/qprocess.html#errorOccurred signal. People don't bother and then wonder what's happening when an error is reported....

        1 Reply Last reply
        1

        • Login

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