zen-gitsync 1.3.7 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/gitCommit.js +14 -17
package/package.json
CHANGED
package/src/gitCommit.js
CHANGED
|
@@ -92,21 +92,6 @@ const getCwd = () => {
|
|
|
92
92
|
return process.cwd()
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// 有时候有乱码呢123神奇
|
|
96
|
-
|
|
97
|
-
const rl = readline.createInterface({
|
|
98
|
-
input: process.stdin,
|
|
99
|
-
output: process.stdout
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
function rlPromisify(fn) {
|
|
103
|
-
return async (...args) => {
|
|
104
|
-
return new Promise((resolve, reject) => fn(...args, resolve, reject))
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const question = rlPromisify(rl.question.bind(rl))
|
|
109
|
-
|
|
110
95
|
class GitCommit {
|
|
111
96
|
constructor(options) {
|
|
112
97
|
this.statusOutput = null
|
|
@@ -169,6 +154,18 @@ class GitCommit {
|
|
|
169
154
|
|
|
170
155
|
if (!autoCommit && !commitMessageArg) {
|
|
171
156
|
// 如果没有 -y 参数,则等待用户输入提交信息
|
|
157
|
+
const rl = readline.createInterface({
|
|
158
|
+
input: process.stdin,
|
|
159
|
+
output: process.stdout
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
function rlPromisify(fn) {
|
|
163
|
+
return async (...args) => {
|
|
164
|
+
return new Promise((resolve, reject) => fn(...args, resolve, reject))
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const question = rlPromisify(rl.question.bind(rl))
|
|
172
169
|
this.commitMessage = await question('请输入提交信息:');
|
|
173
170
|
}
|
|
174
171
|
|
|
@@ -346,7 +343,7 @@ class GitCommit {
|
|
|
346
343
|
let {encoding = 'utf-8', maxBuffer = 30 * 1024 * 1024, head = command, log = true} = options
|
|
347
344
|
try {
|
|
348
345
|
let cwd = getCwd()
|
|
349
|
-
const output = execSync(command, {encoding, maxBuffer, cwd})
|
|
346
|
+
const output = execSync(command, {env: { ...process.env, LANG: 'C.UTF-8' },encoding, maxBuffer, cwd})
|
|
350
347
|
if (options.spinner) {
|
|
351
348
|
options.spinner.stop();
|
|
352
349
|
}
|
|
@@ -364,7 +361,7 @@ class GitCommit {
|
|
|
364
361
|
return new Promise((resolve, reject) => {
|
|
365
362
|
let {encoding = 'utf-8', maxBuffer = 30 * 1024 * 1024, head = command, log = true} = options
|
|
366
363
|
let cwd = getCwd()
|
|
367
|
-
exec(command, {encoding, maxBuffer, cwd}, (error, stdout, stderr) => {
|
|
364
|
+
exec(command, {env: { ...process.env, LANG: 'C.UTF-8' },encoding, maxBuffer, cwd}, (error, stdout, stderr) => {
|
|
368
365
|
if (options.spinner) {
|
|
369
366
|
options.spinner.stop();
|
|
370
367
|
}
|