Преглед на файлове

Fix exit on script error.

git-svn-id: https://klish.googlecode.com/svn/trunk@239 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev преди 13 години
родител
ревизия
989d349e5f
променени са 2 файла, в които са добавени 8 реда и са изтрити 11 реда
  1. 0 9
      clish/shell/shell_spawn.c
  2. 8 2
      clish/shell/shell_tinyrl.c

+ 0 - 9
clish/shell/shell_spawn.c

@@ -168,15 +168,6 @@ static void *clish_shell_thread(void *arg)
 			if (this->state != SHELL_STATE_SCRIPT_ERROR) {
 				/* get input from the user */
 				running = clish_shell_readline(this);
-				/*
-				 * what we do now depends on whether we are set up to
-				 * stop on error on not.
-				 */
-				if (!running && (BOOL_TRUE ==
-					this->current_file->stop_on_error) &&
-					(BOOL_FALSE ==
-					tinyrl__get_isatty(this->tinyrl)))
-					this->state = SHELL_STATE_SCRIPT_ERROR;
 			}
 			if ((BOOL_FALSE == running) ||
 			    (this->state == SHELL_STATE_SCRIPT_ERROR)) {

+ 8 - 2
clish/shell/shell_tinyrl.c

@@ -428,8 +428,14 @@ bool_t clish_shell_execline(clish_shell_t *this, const char *line)
 	lub_string_free(prompt);
 
 	/* execute the provided command */
-	if (running && cmd && pargv)
-		running = clish_shell_execute(this, cmd, pargv);
+	if (running && cmd && pargv) {
+		if (BOOL_FALSE == clish_shell_execute(this, cmd, pargv)) {
+			if((BOOL_TRUE == this->current_file->stop_on_error) &&
+				(BOOL_FALSE == tinyrl__get_isatty(this->tinyrl))) {
+				this->state = SHELL_STATE_SCRIPT_ERROR;
+			}
+		}
+	}
 
 	if (NULL != pargv)
 		clish_pargv_delete(pargv);