Skip to content

Commit

Permalink
fix(execute): agrego process.cwd() a las rutas temporales
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
jansanchez committed Sep 1, 2015
1 parent 91d8eaa commit 434af63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/package/lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Execute.prototype.readFile = function() {
var flag;
flag = true;
this.output = 'error';
while (!fs.existsSync('./done')) {
while (!fs.existsSync(process.cwd() + '/done')) {
this.attempts++;
if (this.attempts > 250) {
flag = false;
Expand All @@ -53,15 +53,15 @@ Execute.prototype.readFile = function() {

Execute.prototype.validateFlag = function(flag) {
if (flag) {
this.output = fs.readFileSync('./output', {
this.output = fs.readFileSync(process.cwd() + '/output', {
encoding: 'utf8'
}).toString().replace(/\n/gi, '');
}
};

Execute.prototype.reset = function() {
rimraf('./done', function() {});
rimraf('./output', function() {});
rimraf(process.cwd() + '/done', function() {});
rimraf(process.cwd() + '/output', function() {});
this.attempts = 0;
};

Expand Down
10 changes: 5 additions & 5 deletions source/coffee/package/lib/execute.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ Execute::readFile = () ->
flag = true
@output = 'error'

while (!fs.existsSync('./done'))
while (!fs.existsSync(process.cwd() + '/done'))
@attempts++
if @attempts > 250
flag = false
break

@validateFlag(flag)

return


Execute::validateFlag = (flag) ->
if flag
@output = fs.readFileSync('./output', {encoding: 'utf8'}).toString().replace(/\n/gi, '')
@output = fs.readFileSync(process.cwd() + '/output', {encoding: 'utf8'}).toString().replace(/\n/gi, '')
return

Execute::reset = () ->
rimraf('./done', ()->
rimraf(process.cwd() + '/done', ()->
return
)
rimraf('./output', ()->
rimraf(process.cwd() + '/output', ()->
return
)
@attempts = 0
Expand Down

0 comments on commit 434af63

Please sign in to comment.