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. Cannot pass arguments to git process
QtWS25 Last Chance

Cannot pass arguments to git process

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 199 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
    smallC
    wrote on last edited by
    #1

    Hi guys, I'm having problem sending arguments to git process under Linux Ubuntu. This is the code

    QProcess process;
    connect(&process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &my_class::onProcessFinished);
    
        const QString git_process_path{"git"};
        process.setWorkingDirectory(repo.location_.path());
        const QByteArray command = prepare_git_command();
        const QStringList list = QStringList() << "config --list";//<<Here, if the arg count is more than one it doesn't work
        process.start(git_process_path, list);
    

    and slot:

    void my_class::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
    {
        const QString output{process.readAllStandardOutput()};
    }
    

    Basically if I do this:

    const QStringList list = QStringList() << "status";//<<Here, if the arg count is one it works
        process.start(git_process_path, list);
    

    Then it works, but as soon as I have more than one argument, for exaple:

    const QStringList list = QStringList() << "config --list";//<<Here, if the arg count is more than one it doesn't work
        process.start(git_process_path, list);
    

    there is no output.
    How to solve it?
    Thanks in advance.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      That's not the right way to pass multiple arguments.
      Why does it use a QStringList if you pass all the arguments in one string?
      You should do like

      QStringList() << "config"  << "--list"
      
      1 Reply Last reply
      3
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @smallC said in Cannot pass arguments to git process:

        QProcess process;

        Where do you create this object?

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        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