easegit-cli 1.0.6 → 1.0.7
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/dist/git/plumbing.js +13 -10
- package/package.json +1 -1
package/dist/git/plumbing.js
CHANGED
|
@@ -51,16 +51,19 @@ const path = __importStar(require("path"));
|
|
|
51
51
|
* Execute a Git command and return output
|
|
52
52
|
*/
|
|
53
53
|
function gitExec(args, cwd) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
const result = (0, child_process_1.spawnSync)('git', args, {
|
|
55
|
+
cwd: cwd || process.cwd(),
|
|
56
|
+
encoding: 'utf8',
|
|
57
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
58
|
+
});
|
|
59
|
+
if (result.error) {
|
|
60
|
+
throw new Error(`Git command failed: ${result.error.message}`);
|
|
61
|
+
}
|
|
62
|
+
if (result.status !== 0) {
|
|
63
|
+
const stderr = result.stderr ? result.stderr.toString().trim() : '';
|
|
64
|
+
throw new Error(`Git command failed: ${stderr || 'Unknown error'}`);
|
|
65
|
+
}
|
|
66
|
+
return (result.stdout || '').toString().trim();
|
|
64
67
|
}
|
|
65
68
|
/**
|
|
66
69
|
* Check if current directory is a Git repository
|