Skip to content

Commit

Permalink
Fixed issue: #4
Browse files Browse the repository at this point in the history
  • Loading branch information
rabchev committed Apr 2, 2014
1 parent 2be4ffa commit 3d8502a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 6 additions & 3 deletions lib/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ function initialize(server, options, fn) {
stdin = proc.stdin;
}

proc.on("error", function (data) {
// Do nothing, we have to handle this event to prevent exceptoin bubbling.
proc.on("error", function (err) {
if (err.code === "ENOENT") {
err.message = cmd + ": command not found";
}
socket.emit("console", err.message);
});

proc.stdout.setEncoding("utf8");
Expand All @@ -178,7 +181,7 @@ function initialize(server, options, fn) {
socket.emit("console", data);
});

proc.on("close", function (code, signal) {
proc.on("close", function () {
stdin = null;
socket.emit("exit", "");
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "web-terminal",
"description": "Web-Terminal is a terminal server that provides remote CLI via standard web browser and HTTP protocol.",
"version": "0.6.3",
"version": "0.6.4",
"author": "Boyan Rabchev <boyan@rabchev.com>",
"contributors": [
"contributors": [
{ "name": "Boyan Rabchev", "email": "boyan@rabchev.com" }
],
"config": {
Expand Down
7 changes: 2 additions & 5 deletions web/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,11 @@
function convertToHtml(data) {

var i,
j,
chr,
output = "",
idx = index,
seq = 0,
closures = [],
closure,
res;


Expand Down Expand Up @@ -271,7 +269,6 @@

$(window.document).keydown(function (e) {
var part1, part2;
var charCode = (typeof e.which === "number") ? e.which : e.keyCode;

switch (e.keyCode) {
case 8: // Backspace
Expand All @@ -288,7 +285,7 @@
cursorPos--;
moveCursor();
}
break;
return false;
case 46: // Delete
e.stopImmediatePropagation();
if (currentLine.length > cursorPos) {
Expand All @@ -299,7 +296,7 @@

moveCursor();
}
break;
return false;
case 38: // Up Arrow
e.stopImmediatePropagation();
if (linePos < lines.length - 1) {
Expand Down

0 comments on commit 3d8502a

Please sign in to comment.