Skip to content

Commit

Permalink
Apply workaround for [issue in the write()-method of q-io/fs](kri…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Knappmeier committed Oct 5, 2015
1 parent 807402c commit 02579c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This project adheres to [Semantic Versioning](http://semver.org/).

## Upcoming

### Fix

* Apply workaround for [issue in the `write()`-method of `q-io/fs`](https://github.com/kriskowal/q-io/issues/149)

## v0.5.1 - 2015-09-28

### Fix
Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
var customize = require('customize')
var Q = require('q')
var qfs = require('q-io/fs')
var fs = require('fs')
var debug = require('debug')('thought:run')

module.exports = thought
Expand All @@ -29,10 +30,13 @@ function thought (options) {
.then(function (result) {
debug('customize-result', result)
return Q.all(Object.keys(result.handlebars).map(function (filename) {
return qfs.write(filename, result.handlebars[filename])
.then(function () {
return filename
})
// qfs.write has issues in node 4.1.0, so we create a simple wrapper using
// Q.defer() and fs.writeFile()
var defer = Q.defer();
fs.writeFile(filename, result.handlebars[filename], defer.makeNodeResolver());
return defer.promise.then(function () {
return filename
})
}))
})
.then(function (filenames) {
Expand Down

0 comments on commit 02579c4

Please sign in to comment.