Skip to content

Commit 3b9b521

Browse files
committed
Re-add wait for stopped programState
We load the program, which will fail if the program is not found or the requested file does not contain a valid program. Afterwards, we wait until the program state is stopped with a program named the same as the requested program. We cannot check the full file path here, but the important thing is that the program state is stopped.
1 parent 03b47d5 commit 3b9b521

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ur/dashboard_client.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727
//----------------------------------------------------------------------
2828

29+
#include <filesystem>
2930
#include <iostream>
3031
#include <regex>
3132
#include <thread>
@@ -246,7 +247,12 @@ bool DashboardClient::commandBrakeRelease()
246247
bool DashboardClient::commandLoadProgram(const std::string& program_file_name)
247248
{
248249
assertVersion("5.0.0", "1.4", "load <program>");
249-
return sendRequest("load " + program_file_name + "", "(?:Loading program: ).*(?:" + program_file_name + ").*");
250+
// We load the program, which will fail if the program is not found or the requested file does
251+
// not contain a valid program. Afterwards, we wait until the program state is stopped with a
252+
// program named the same as the requested program. We cannot check the full file path here, but
253+
// the important thing is that the program state is stopped.
254+
return sendRequest("load " + program_file_name + "", "(?:Loading program: ).*(?:" + program_file_name + ").*") &&
255+
waitForReply("programState", "STOPPED " + std::filesystem::path{ program_file_name }.filename().string());
250256
}
251257

252258
bool DashboardClient::commandLoadInstallation(const std::string& installation_file_name)

0 commit comments

Comments
 (0)