Skip to content

Commit eb09ff1

Browse files
Fix GUI detection and add issue comments
1 parent fcf3d55 commit eb09ff1

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

eidos/eidos_functions_files.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -227,24 +227,14 @@ EidosValue_SP Eidos_ExecuteFunction_readLine(const std::vector<EidosValue_SP> &p
227227
{
228228
#pragma unused (p_arguments)
229229

230-
EidosValue_SP result_SP(nullptr);
231-
232-
// Check if running in SLiMgui
233-
// Also check if stdin is a TTY to catch redirected input
234-
EidosSymbolTable &symbols = p_interpreter.SymbolTable();
235-
EidosGlobalStringID slimgui_id = EidosStringRegistry::GlobalStringIDForString("slimgui");
236-
bool in_slimgui = symbols.ContainsSymbol(slimgui_id);
237-
bool stdin_is_tty = isatty(fileno(stdin));
230+
#ifdef EIDOS_GUI
231+
EIDOS_TERMINATION << "ERROR (Eidos_ExecuteFunction_readLine): function readLine() is not available in GUI environments (SLiMgui, SLiMguiLegacy, or EidosScribe)." << EidosTerminate(nullptr);
232+
#endif
233+
234+
// This function was implemented by Chris Talbot 11/19/25 for use in reinforcement learning environments.
235+
// Associated with issue #576.
238236

239-
if (in_slimgui || !stdin_is_tty)
240-
{
241-
// Emit a warning and return empty string to avoid blocking the GUI
242-
if (!gEidosSuppressWarnings)
243-
p_interpreter.ErrorOutputStream() << "#WARNING (Eidos_ExecuteFunction_readLine): function readLine() is not available when stdin is not connected to an interactive terminal (e.g., when running in SLiMgui or with redirected input). Returning empty string." << std::endl;
244-
245-
result_SP = EidosValue_SP(new (gEidosValuePool->AllocateChunk()) EidosValue_String(""));
246-
return result_SP;
247-
}
237+
EidosValue_SP result_SP(nullptr);
248238

249239
// Read a single line from stdin (command-line mode with interactive terminal)
250240
std::string line;

0 commit comments

Comments
 (0)