termApp.controller("mainController", function($scope) {
	var terminal = require('child_process').spawn('bash');

	$scope.command = "";
	$scope.output = "";

	terminal.stdout.on('data', function(m) {
		// Receive results from child process
		$scope.output += m;
		$scope.$apply();
	});


	$scope.execute = (keyEvent) => {
		if (keyEvent.which === 13) {
			terminal.stdin.write(`${$scope.command}\n`);

			$scope.output += `${$scope.command}\n\n`;
		}
	}

	window.onbeforeunload = function() {
		terminal.close();
	}
});

termApp.controller("mainController", function($scope) {
	var exec = require('executive');
	var stream = require('stream');

	var echoStream = new stream.Writable();
	$scope.command = "";
	$scope.output = "";
	var shell = exec("/bin/bash", {options: 'interactive'}, function(err, stdout) {
		console.log("teste", stdout);
	});

	console.log(shell);

	echoStream._write = function (chunk, encoding, done) {
		$scope.output += chunk.toString();

		window.scrollTo(0,document.body.scrollHeight);
		done();
	};

	shell.stdout.pipe(echoStream);

	$scope.execute = (keyEvent) => {
		if (keyEvent.which === 13) {


			$scope.output += `${$scope.command}\n\n`;


			shell.stdin = "ls"

			console.log(shell);

		}
	}


});

--- 
+++ 
@@ -1,25 +1,38 @@
 termApp.controller("mainController", function($scope) {
-	var terminal = require('child_process').spawn('bash');
+	var exec = require('executive');
+	var stream = require('stream');
 
+	var echoStream = new stream.Writable();
 	$scope.command = "";
 	$scope.output = "";
-
-	terminal.stdout.on('data', function(m) {
-		// Receive results from child process
-		$scope.output += m;
-		$scope.$apply();
+	var shell = exec("/bin/bash", {options: 'interactive'}, function(err, stdout) {
+		console.log("teste", stdout);
 	});
 
+	console.log(shell);
+
+	echoStream._write = function (chunk, encoding, done) {
+		$scope.output += chunk.toString();
+
+		window.scrollTo(0,document.body.scrollHeight);
+		done();
+	};
+
+	shell.stdout.pipe(echoStream);
 
 	$scope.execute = (keyEvent) => {
 		if (keyEvent.which === 13) {
-			terminal.stdin.write(`${$scope.command}\n`);
+
 
 			$scope.output += `${$scope.command}\n\n`;
+
+
+			shell.stdin = "ls"
+
+			console.log(shell);
+
 		}
 	}
 
-	window.onbeforeunload = function() {
-		terminal.close();
-	}
+
 });
Move to usage of child process
