| 6996 | } |
| 6997 | |
| 6998 | void ScriptingObjects::ScriptBackgroundTask::ChildProcessData::run() |
| 6999 | { |
| 7000 | if (args.isEmpty()) |
| 7001 | { |
| 7002 | debugError(dynamic_cast<Processor*>(parent.getScriptProcessor()), "no args"); |
| 7003 | return; |
| 7004 | } |
| 7005 | |
| 7006 | childProcess.start(args, ChildProcess::StreamFlags::wantStdErr | ChildProcess::StreamFlags::wantStdOut); |
| 7007 | |
| 7008 | var a[3]; |
| 7009 | |
| 7010 | a[0] = &parent; |
| 7011 | a[1] = false; |
| 7012 | |
| 7013 | String currentLine; |
| 7014 | |
| 7015 | while (childProcess.isRunning()) |
| 7016 | { |
| 7017 | if (parent.shouldAbort()) |
| 7018 | { |
| 7019 | childProcess.kill(); |
| 7020 | break; |
| 7021 | } |
| 7022 | |
| 7023 | char newChar; |
| 7024 | |
| 7025 | auto numBytesRead = childProcess.readProcessOutput(&newChar, 1); |
| 7026 | |
| 7027 | if (numBytesRead == 1) |
| 7028 | { |
| 7029 | currentLine << newChar; |
| 7030 | |
| 7031 | if (newChar == '\n' || newChar == '\r') |
| 7032 | { |
| 7033 | if (currentLine.trim().isNotEmpty()) |
| 7034 | { |
| 7035 | a[2] = var(currentLine); |
| 7036 | callLog(a); |
| 7037 | } |
| 7038 | |
| 7039 | currentLine = {}; |
| 7040 | |
| 7041 | parent.wait(10); |
| 7042 | } |
| 7043 | } |
| 7044 | |
| 7045 | parent.wait(1); |
| 7046 | } |
| 7047 | |
| 7048 | currentLine << childProcess.readAllProcessOutput(); |
| 7049 | |
| 7050 | if (!currentLine.isEmpty()) |
| 7051 | { |
| 7052 | a[2] = var(currentLine); |
| 7053 | callLog(a); |
| 7054 | } |
| 7055 |
nothing calls this directly
no test coverage detected