1 | #include "GitRequestorProcess.h" |
---|---|
2 | |
3 | #include <QTemporaryFile> |
4 | GitRequestorProcess::GitRequestorProcess(const QString &workingDir) |
5 | : AGitProcess(workingDir) |
6 | { |
7 | } |
8 | |
9 | GitExecResult GitRequestorProcess::run(const QString &command) |
10 | { |
11 | auto ret = false; |
12 | |
13 | // Create temporary file |
14 | mTempFile = new QTemporaryFile(this); |
15 | |
16 | if (mTempFile->open()) // to read the file name |
17 | { |
18 | setStandardOutputFile(mTempFile->fileName()); |
19 | mTempFile->close(); |
20 | |
21 | ret = execute(command); |
22 | } |
23 | |
24 | return { ret, ""}; |
25 | } |
26 | |
27 | void GitRequestorProcess::onFinished(int, QProcess::ExitStatus) |
28 | { |
29 | bool ok = mTempFile && (mTempFile->isOpen() || (mTempFile->exists() && mTempFile->open())); |
30 | |
31 | if (ok && !mCanceling) |
32 | emit procDataReady(mTempFile->readAll()); |
33 | |
34 | deleteLater(); |
35 | } |
36 |