Permalink
Browse files

Fix grunt run check for config file existance

  • Loading branch information...
1 parent b21caee commit 99f7c0a0d75c967bb9bdc827d331e0cdb66352dd @aron aron committed Jul 1, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 grunt.js
View
@@ -17,13 +17,19 @@ module.exports = function (grunt) {
grunt.registerTask('run', 'Runs JSBin for local development', function (config) {
var done = this.async(),
filepath = path.join(__dirname, config || 'config.node.json'),
- configExists = fs.statSync(filepath).isFile(),
cmd = '[ -e "`which nodemon`" ] && nodemon --debug . || node --debug .',
child;
// Set the config for the node app.
- if (configExists && !process.env.JSBIN_CONFIG) {
- process.env.JSBIN_CONFIG = filepath;
+ try {
+ if (fs.statSync(filepath).isFile() && !process.env.JSBIN_CONFIG) {
+ process.env.JSBIN_CONFIG = filepath;
+ }
+ } catch (error) {
+ // Ignore if file wasn't found.
+ if (error.errno !== 34 /* ENOENT */) {
+ throw error;
+ }
}
child = exec(cmd, function (err, stdout, stderr) {

0 comments on commit 99f7c0a

Please sign in to comment.