Created
April 3, 2016 08:03
-
-
Save chuck0523/b31f359b7e2cedb9f2cbd6930fe22aea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watch = require('fs').watch | |
var exec = require('child_process').exec | |
var echoFile = (fileName) => { | |
console.log('execute command...') | |
exec('less ' + fileName, (error, stdout, stderr) => { | |
console.log(stdout) | |
}) | |
} | |
watch('index.js', (event, fileName) => { | |
console.log(event + ' to ' + fileName) | |
echoFile(fileName) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment