@@ -57,10 +57,11 @@ i32_t main(i32_t argc, str_p argv[]) {
5757 i32_t code = -1 ;
5858 sys_info_t * info ;
5959 runtime_p runtime ;
60- obj_p interactive_arg , port_arg , file_arg , res , fmt ;
60+ obj_p interactive_arg , port_arg , file_arg , repl_arg , res , fmt ;
6161 b8_t interactive = B8_FALSE ;
6262 b8_t has_file = B8_FALSE ;
6363 b8_t file_error = B8_FALSE ;
64+ b8_t repl_disabled = B8_FALSE ;
6465
6566 runtime = runtime_create (argc , argv );
6667 if (runtime == NULL )
@@ -71,6 +72,14 @@ i32_t main(i32_t argc, str_p argv[]) {
7172 interactive = !is_null (interactive_arg );
7273 drop_obj (interactive_arg );
7374
75+ // Check if REPL is explicitly disabled (-r 0)
76+ repl_arg = runtime_get_arg ("repl" );
77+ if (!is_null (repl_arg )) {
78+ if (repl_arg -> len == 1 && AS_C8 (repl_arg )[0 ] == '0' )
79+ repl_disabled = B8_TRUE ;
80+ }
81+ drop_obj (repl_arg );
82+
7483 // Check if port is specified (-p/--port) — implies server mode
7584 port_arg = runtime_get_arg ("port" );
7685 if (!is_null (port_arg ))
@@ -104,14 +113,16 @@ i32_t main(i32_t argc, str_p argv[]) {
104113
105114 // Interactive mode: no file, or file with -i flag
106115 // Only show logo and REPL if stdin is a TTY (not piped input)
107- if (isatty (STDIN_FILENO )) {
116+ if (! repl_disabled && isatty (STDIN_FILENO )) {
108117 info = & runtime_get ()-> sys_info ;
109118 print_logo (info );
110119 }
111120
112121 // Create REPL for interactive mode (handles both TTY and piped input)
122+ // When REPL is disabled (-r 0), skip entirely — daemon/server mode:
123+ // the event loop runs with only the port listener, no stdin interaction.
113124 repl_p repl = NULL ;
114- if (runtime -> poll )
125+ if (! repl_disabled && runtime -> poll )
115126 repl = repl_create (runtime -> poll );
116127
117128 code = runtime_run ();
0 commit comments