Commit e79f904f authored by shangbj's avatar shangbj

1

parent 5a3e16b6
......@@ -7,28 +7,29 @@ const fs = require('fs')
// const path = require('path')
// const shell = require('shelljs')
// 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){
// console.log('err',err)
// console.log('stdout',stdout)
// console.log('stderr',stderr)
// })
let stream = ''
if (process.platform === 'win32') {
// husky不支持配置.git/hooks/xx 中的sh脚本
// 需要手动加入 exec < /dev/tty 开启交互
stream = process.stdin;
} else {
stream = fs.createReadStream('/dev/tty');
}
// let stream = ''
// if (process.platform === 'win32') {
// // husky不支持配置.git/hooks/xx 中的sh脚本
// // 需要手动加入 exec < /dev/tty 开启交互
// stream = process.stdin;
// } else {
// stream = fs.createReadStream('/dev/tty');
// }
stream.setEncoding('utf-8');
stream.on('error', () => {
// do something...
});
stream.on('data', (data) => {
// do something...
comsole.log(data)
});
\ No newline at end of file
// stream.setEncoding('utf-8');
// stream.on('error', () => {
// // do something...
// });
// stream.on('data', (data) => {
// // do something...
// console.log(data)
// });
\ 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