Skip to content

Commit b58f7d8

Browse files
Fix I/O buffering issues in interactive authentication
- Add flush(stdout) before readline() calls to ensure prompts are displayed - Separate prompt text from input line for better readability - Add flush after success/error messages to ensure they're shown - Use "Token: " prefix for cleaner input formatting - Prevents REPL window issues and ensures reliable interactive input 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1e31f82 commit b58f7d8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ function setup_github_authentication()
4141
println(" • Repository access: 'Public Repositories (read-only)'")
4242
println("4️⃣ Click 'Generate token' and copy it")
4343
println()
44-
45-
print("🔑 Paste your GitHub token here (or press Enter to skip): ")
44+
println("🔑 Paste your GitHub token here (or press Enter to skip):")
45+
print("Token: ")
46+
flush(stdout) # Ensure the prompt is displayed before reading
4647
token = strip(readline())
4748

4849
if !isempty(token)
@@ -51,14 +52,17 @@ function setup_github_authentication()
5152
ENV["GITHUB_TOKEN"] = token
5253
auth = GitHub.authenticate(token)
5354
println("✅ Perfect! Authentication successful - your results will help everyone!")
55+
flush(stdout) # Ensure success message is displayed
5456
return auth
5557
catch e
5658
println("❌ Token authentication failed: $e")
5759
println("💡 Make sure the token has 'public_repo' or 'Public Repositories' access")
60+
flush(stdout) # Ensure error messages are displayed
5861
delete!(ENV, "GITHUB_TOKEN")
5962
attempts += 1
6063
if attempts < max_attempts
6164
println("🔄 Let's try again...")
65+
flush(stdout)
6266
continue
6367
end
6468
end
@@ -70,7 +74,9 @@ function setup_github_authentication()
7074
println(" Your hardware's benchmark data improves algorithm selection for everyone.")
7175
println(" It only takes 30 seconds and makes LinearSolve.jl better for all users.")
7276
println()
73-
print("🤝 Please help the community - try setting up the token? (y/n): ")
77+
println("🤝 Please help the community - try setting up the token?")
78+
print("Response (y/n): ")
79+
flush(stdout) # Ensure the prompt is displayed before reading
7480
response = strip(lowercase(readline()))
7581
if response == "n" || response == "no"
7682
attempts += 1

0 commit comments

Comments
 (0)