@@ -14,6 +14,7 @@ export async function convertGradleToMaven(
1414) {
1515 // Lazily access constants.spinner.
1616 const { spinner } = constants
17+
1718 const rbin = path . resolve ( bin )
1819 const rtarget = path . resolve ( target )
1920
@@ -29,10 +30,6 @@ export async function convertGradleToMaven(
2930 logger . groupEnd ( )
3031 }
3132
32- spinner . start (
33- `Converting gradle to maven from \`${ bin } \` on \`${ target } \`...`
34- )
35-
3633 try {
3734 // Run sbt with the init script we provide which should yield zero or more pom files.
3835 // We have to figure out where to store those pom files such that we can upload them and predict them through the GitHub API.
@@ -43,8 +40,13 @@ export async function convertGradleToMaven(
4340 const commandArgs = [ '--init-script' , initLocation , ...gradleOpts , 'pom' ]
4441
4542 if ( verbose ) {
46- spinner . log ( '[VERBOSE] Executing:' , bin , commandArgs )
43+ logger . log ( '[VERBOSE] Executing:' , bin , commandArgs )
4744 }
45+
46+ spinner . start (
47+ `Converting gradle to maven from \`${ bin } \` on \`${ target } \`...`
48+ )
49+
4850 const output = await spawn ( bin , commandArgs , {
4951 cwd : target || '.'
5052 } )
@@ -64,7 +66,8 @@ export async function convertGradleToMaven(
6466 logger . error ( output . stderr )
6567 logger . groupEnd ( )
6668 }
67- process . exit ( 1 )
69+ process . exitCode = 1
70+ return
6871 }
6972 logger . success ( 'Executed gradle successfully' )
7073 logger . log ( 'Reported exports:' )
@@ -104,8 +107,7 @@ export async function convertGradleToMaven(
104107 // spinner.successAndStop(`OK. File should be available in \`${out}\``)
105108 // }
106109 } catch ( e : any ) {
107- spinner . stop ( )
108- logger . error (
110+ spinner . errorAndStop (
109111 'There was an unexpected error while running this' +
110112 ( verbose ? '' : ' (use --verbose for details)' )
111113 )
@@ -114,6 +116,8 @@ export async function convertGradleToMaven(
114116 logger . log ( e )
115117 logger . groupEnd ( )
116118 }
117- process . exit ( 1 )
119+ process . exitCode = 1
120+ } finally {
121+ spinner . stop ( )
118122 }
119123}
0 commit comments