Commit e79f904f authored by shangbj's avatar shangbj

1

parent 5a3e16b6
...@@ -7,28 +7,29 @@ const fs = require('fs') ...@@ -7,28 +7,29 @@ const fs = require('fs')
// const path = require('path') // const path = require('path')
// const shell = require('shelljs') // const shell = require('shelljs')
// const exec = require('child_process').exec // const exec = require('child_process').exec
// var commitMsg = fs.readFileSync(path.resolve(__dirname, 'git-push.sh'), 'utf-8'); var commitMsg = fs.readFileSync(path.resolve(__dirname, '../.git/refs/heads'), 'utf-8');
console.log(commitMsg)
// exec('git diff --name-only', function(err, stdout,stderr){ // exec('git diff --name-only', function(err, stdout,stderr){
// console.log('err',err) // console.log('err',err)
// console.log('stdout',stdout) // console.log('stdout',stdout)
// console.log('stderr',stderr) // console.log('stderr',stderr)
// }) // })
let stream = '' // let stream = ''
if (process.platform === 'win32') { // if (process.platform === 'win32') {
// husky不支持配置.git/hooks/xx 中的sh脚本 // // husky不支持配置.git/hooks/xx 中的sh脚本
// 需要手动加入 exec < /dev/tty 开启交互 // // 需要手动加入 exec < /dev/tty 开启交互
stream = process.stdin; // stream = process.stdin;
} else { // } else {
stream = fs.createReadStream('/dev/tty'); // stream = fs.createReadStream('/dev/tty');
} // }
stream.setEncoding('utf-8'); // stream.setEncoding('utf-8');
stream.on('error', () => { // stream.on('error', () => {
// do something... // // do something...
}); // });
stream.on('data', (data) => { // stream.on('data', (data) => {
// do something... // // do something...
comsole.log(data) // console.log(data)
}); // });
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment