Cannot pass arguments to git process
Solved
General and Desktop
-
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. -
@smallC said in Cannot pass arguments to git process:
QProcess process;
Where do you create this object?