mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Don't exit if 'exit' or 'quit' are in quote blocks
This commit is contained in:
+10
-3
@@ -182,12 +182,19 @@ main(void)
|
||||
last_code_line[char_index] = '\0';
|
||||
|
||||
if ((strcmp(last_code_line, "quit") == 0) || (strcmp(last_code_line, "exit") == 0)) {
|
||||
/*:quit the program */
|
||||
break;
|
||||
if (!code_block_open || !parser->sterm){
|
||||
break;
|
||||
}
|
||||
else{
|
||||
/* count the quit/exit commands as strings if in a quote block */
|
||||
strcat(ruby_code, "\n");
|
||||
strcat(ruby_code, last_code_line);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (code_block_open) {
|
||||
strcat(ruby_code, "\n");
|
||||
strcat(ruby_code, "\n");
|
||||
strcat(ruby_code, last_code_line);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user