summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 1735c67..b38dc27 100644
--- a/src/main.c
+++ b/src/main.c
@@ -202,6 +202,7 @@ cmdloop(int top)
 	union node *n;
 	struct stackmark smark;
 	int inter;
+	int status = 0;
 	int numeof = 0;
 
 	TRACE(("cmdloop(%d) called\n", top));
@@ -235,6 +236,7 @@ cmdloop(int top)
 			job_warning = (job_warning == 2) ? 1 : 0;
 			numeof = 0;
 			evaltree(n, 0);
+			status = exitstatus;
 		}
 		popstackmark(&smark);
 
@@ -245,7 +247,7 @@ cmdloop(int top)
 		}
 	}
 
-	return 0;
+	return status;
 }
 
 
@@ -325,9 +327,8 @@ dotcmd(int argc, char **argv)
 		fullname = find_dot_file(argv[1]);
 		setinputfile(fullname, INPUT_PUSH_FILE);
 		commandname = fullname;
-		cmdloop(0);
+		status = cmdloop(0);
 		popfile();
-		status = exitstatus;
 	}
 	return status;
 }