@@ -48,6 +48,7 @@ Task createUploadSourcemapsTask(String flavor, String defaultVersionName, String
48
48
49
49
def tokenShellFile = new File (instabugDir, ' scripts/find-token.sh' )
50
50
def inferredToken = executeShellScript(tokenShellFile, jsProjectDir)
51
+
51
52
def appToken = resolveVar(' App Token' , ' INSTABUG_APP_TOKEN' , inferredToken)
52
53
53
54
def versionName = resolveVar(' Version Name' , ' INSTABUG_VERSION_NAME' , defaultVersionName)
@@ -174,9 +175,22 @@ static String executeShellScript(File script, File workingDir) {
174
175
return null
175
176
}
176
177
178
+ if (! script. canExecute()) {
179
+ // Try to set executable permission
180
+ script. setExecutable(true )
181
+ }
182
+
177
183
def output = new StringBuffer ()
184
+ def error = new StringBuffer ()
185
+
186
+ // Using 'sh' instead of './' to avoid needing exec permission, but keeping chmod above just in case
178
187
def process = [' sh' , script. getAbsolutePath()]. execute(null , workingDir)
179
- process?. waitForProcessOutput(output, new StringBuffer ())
188
+ process?. waitForProcessOutput(output, error)
189
+
190
+ if (process. exitValue() != 0 ) {
191
+ println " Error running script: ${ error.toString().trim()} "
192
+ return null
193
+ }
180
194
181
- return process ?. exitValue() == 0 ? output. toString(). trim() : null
195
+ return output. toString(). trim()
182
196
}
0 commit comments