Skip to content

Commit

Permalink
darwin-framework-tool: Remove racy access to readline (#20634)
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton36 authored and pull[bot] committed Sep 12, 2023
1 parent 485da59 commit 2277280
Showing 1 changed file with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

namespace {

bool gIsCommandRunning = NO;

void ClearLine()
{
printf("\r\x1B[0J"); // Move cursor to the beginning of the line and clear from cursor to end of the screen
Expand All @@ -44,10 +42,6 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category,
ClearLine();
chip::Logging::Platform::LogV(module, category, msg, args);
ClearLine();

if (gIsCommandRunning == NO) {
rl_forced_update_display();
}
}
} // namespace

Expand Down Expand Up @@ -104,9 +98,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category,
std::stringstream ss(command);
while (ss >> std::quoted(arg)) {
if (argsCount == kInteractiveModeArgumentsMaxLength) {
gIsCommandRunning = YES;
ChipLogError(chipTool, "Too many arguments. Ignoring.");
gIsCommandRunning = NO;
return YES;
}

Expand All @@ -116,9 +108,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category,
}

ClearLine();
gIsCommandRunning = YES;
mHandler->RunInteractive(argsCount, args);
gIsCommandRunning = NO;

// Do not delete arg[0]
while (--argsCount)
Expand Down

0 comments on commit 2277280

Please sign in to comment.