11'use strict' ;
22
3- const { _ , execa } = require ( '@micro-app/shared-utils' ) ;
3+ const { logger , execa } = require ( '@micro-app/shared-utils' ) ;
44
55const TIMEOUT = 1000 * 60 * 3 ;
66
@@ -24,8 +24,13 @@ function execGit(args, options = {}) {
2424}
2525
2626function execGitSync ( args , options = { } ) {
27- const { stdout, exitCode } = execa . sync ( 'git' , args , Object . assign ( { stdio : 'ignore' , timeout : TIMEOUT } , options ) ) ;
28- return exitCode === 0 ? ( stdout || '' ) . trim ( ) : '' ;
27+ try {
28+ const { stdout, exitCode } = execa . sync ( 'git' , args , Object . assign ( { stdio : 'ignore' , timeout : TIMEOUT } , options ) ) ;
29+ return exitCode === 0 ? ( stdout || '' ) . trim ( ) : '' ;
30+ } catch ( error ) {
31+ logger . warn ( 'execGitSync' , error ) ;
32+ return '' ;
33+ }
2934}
3035
3136function getCurrBranch ( ) {
@@ -49,11 +54,11 @@ function getGitBranch(deployConfig) {
4954
5055function getGitUser ( deployConfig ) {
5156 let userName = deployConfig . userName ;
52- if ( _ . isEmpty ( userName ) ) {
57+ if ( ! userName ) {
5358 userName = execGitSync ( [ 'config' , 'user.name' ] ) ;
5459 }
5560 let userEmail = deployConfig . userEmail ;
56- if ( _ . isEmpty ( userEmail ) ) {
61+ if ( ! userEmail ) {
5762 userEmail = execGitSync ( [ 'config' , 'user.email' ] ) ;
5863 }
5964 return {
0 commit comments