Skip to content

Commit

Permalink
testing CI integration...
Browse files Browse the repository at this point in the history
  • Loading branch information
Diullei committed Feb 23, 2013
1 parent df918e8 commit a2fb51b
Show file tree
Hide file tree
Showing 7 changed files with 50,897 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ Properties
*~

# test folder
!_tests/*
!_tests/*
!_tests/*.js
!_tests/*/*.js
!_tests/*/*/*.js
!_tests/*/*/*/*.js
57 changes: 57 additions & 0 deletions _tests/src/exec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var ExecResult = (function () {
function ExecResult() {
this.stdout = "";
this.stderr = "";
}
return ExecResult;
})();
var WindowsScriptHostExec = (function () {
function WindowsScriptHostExec() { }
WindowsScriptHostExec.prototype.exec = function (filename, cmdLineArgs, handleResult) {
var result = new ExecResult();
var shell = new ActiveXObject('WScript.Shell');
try {
var process = shell.Exec(filename + ' ' + cmdLineArgs.join(' '));
} catch (e) {
result.stderr = e.message;
result.exitCode = 1;
handleResult(result);
return;
}
while(process.Status != 0) {
}
result.exitCode = process.ExitCode;
if(!process.StdOut.AtEndOfStream) {
result.stdout = process.StdOut.ReadAll();
}
if(!process.StdErr.AtEndOfStream) {
result.stderr = process.StdErr.ReadAll();
}
handleResult(result);
};
return WindowsScriptHostExec;
})();
var NodeExec = (function () {
function NodeExec() { }
NodeExec.prototype.exec = function (filename, cmdLineArgs, handleResult) {
var nodeExec = require('child_process').exec;
var result = new ExecResult();
result.exitCode = null;
var cmdLine = filename + ' ' + cmdLineArgs.join(' ');
var process = nodeExec(cmdLine, function (error, stdout, stderr) {
result.stdout = stdout;
result.stderr = stderr;
result.exitCode = error ? error.code : 0;
handleResult(result);
});
};
return NodeExec;
})();
var Exec = (function () {
var global = Function("return this;").call(null);
if(typeof global.ActiveXObject !== "undefined") {
return new WindowsScriptHostExec();
} else {
return new NodeExec();
}
})();
Loading

0 comments on commit a2fb51b

Please sign in to comment.