Skip to content

Commit

Permalink
run the "economy mode" repl any time Base._start is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored and ihnorton committed May 20, 2015
1 parent 0e88529 commit 978b3f2
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ extern "C" {
static int lisp_prompt = 0;
static int codecov = JL_LOG_NONE;
static int malloclog= JL_LOG_NONE;
static char *program = NULL;
static int imagepathspecified = 0;

static const char usage[] = "julia [options] [program] [args...]\n";
Expand Down Expand Up @@ -345,13 +344,9 @@ void parse_opts(int *argcp, char ***argvp)
optind -= skip;
*argvp += optind;
*argcp -= optind;
if (jl_options.image_file==NULL && *argcp > 0) {
if (strcmp((*argvp)[0], "-"))
program = (*argvp)[0];
}
}

static int exec_program(void)
static int exec_program(char *program)
{
int err = 0;
again: ;
Expand Down Expand Up @@ -427,13 +422,6 @@ static int true_main(int argc, char *argv[])
}
}

// run program if specified, otherwise enter REPL
if (program) {
int ret = exec_program();
uv_tty_reset_mode();
return ret;
}

jl_function_t *start_client = jl_base_module ?
(jl_function_t*)jl_get_global(jl_base_module, jl_symbol("_start")) : NULL;

Expand All @@ -442,11 +430,19 @@ static int true_main(int argc, char *argv[])
return 0;
}

// run program if specified, otherwise enter REPL
if (argc > 0) {
if (strcmp(argv[0], "-")) {
return exec_program(argv[0]);
}
}

ios_puts("warning: Base._start not defined, falling back to economy mode repl.\n", ios_stdout);
if (!jl_errorexception_type)
ios_puts("warning: jl_errorexception_type not defined; any errors will be fatal.\n", ios_stdout);

while (!ios_eof(ios_stdin)) {
char *line = NULL;
char *volatile line = NULL;
JL_TRY {
ios_puts("\njulia> ", ios_stdout);
ios_flush(ios_stdout);
Expand Down

0 comments on commit 978b3f2

Please sign in to comment.