Commit 0cefa821 authored by nanahira's avatar nanahira

added try

parent 8e37b19f
...@@ -32,6 +32,7 @@ var sendResponse = function(text) { ...@@ -32,6 +32,7 @@ var sendResponse = function(text) {
var pull_data = function(path, remote, branch, callback) { var pull_data = function(path, remote, branch, callback) {
sendResponse("Started pulling on branch "+branch+" at "+path+" from "+remote+"."); sendResponse("Started pulling on branch "+branch+" at "+path+" from "+remote+".");
try {
var proc = spawn("git", ["pull", remote, branch], { cwd: path, env: process.env }); var proc = spawn("git", ["pull", remote, branch], { cwd: path, env: process.env });
proc.stdout.setEncoding('utf8'); proc.stdout.setEncoding('utf8');
proc.stdout.on('data', function(data) { proc.stdout.on('data', function(data) {
...@@ -47,11 +48,18 @@ var pull_data = function(path, remote, branch, callback) { ...@@ -47,11 +48,18 @@ var pull_data = function(path, remote, branch, callback) {
callback(); callback();
} }
}); });
return proc; catch (err) {
sendResponse("Errored pulling on branch "+branch+" at "+path+" from "+remote+".");
if (callback) {
callback();
}
}
return;
} }
var run_custom_callback = function(command, args, path, callback) { var run_custom_callback = function(command, args, path, callback) {
sendResponse("Started running custom callback."); sendResponse("Started running custom callback.");
try {
var proc = spawn(command, args, { cwd: path, env: process.env }); var proc = spawn(command, args, { cwd: path, env: process.env });
proc.stdout.setEncoding('utf8'); proc.stdout.setEncoding('utf8');
proc.stdout.on('data', function(data) { proc.stdout.on('data', function(data) {
...@@ -67,6 +75,12 @@ var run_custom_callback = function(command, args, path, callback) { ...@@ -67,6 +75,12 @@ var run_custom_callback = function(command, args, path, callback) {
callback(); callback();
} }
}); });
} catch (err) {
sendResponse("Errored running custom callback.");
if (callback) {
callback();
}
}
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment