File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,17 +62,25 @@ export async function simctl(action: string, udid: string): Promise<void> {
6262async function xcrun ( tail : string ) : Promise < string > {
6363 const command = `xcrun ${ tail } `
6464 core . info ( `$ ${ command } ` )
65- const { stdout, stderr} = await execAsync ( command )
66- if ( stderr ) {
67- core . warning ( `Errors or warnings in the output of ${ command } ` )
68- core . startGroup ( `[stderr] ${ command } ` )
69- core . warning ( stderr )
70- core . endGroup ( )
71- }
72- if ( core . isDebug ( ) ) {
73- core . startGroup ( `[stdout] ${ command } ` )
74- core . debug ( stdout )
75- core . endGroup ( )
65+
66+ let res : { stdout ?: string ; stderr ?: string } | undefined
67+ try {
68+ res = await execAsync ( command )
69+ return res . stdout || ''
70+ } catch ( e ) {
71+ res = e as { stdout ?: string ; stderr ?: string }
72+ throw e
73+ } finally {
74+ if ( res ?. stderr ) {
75+ core . warning ( `Errors or warnings in the output of ${ command } ` )
76+ core . startGroup ( `[stderr] ${ command } ` )
77+ core . warning ( res . stderr )
78+ core . endGroup ( )
79+ }
80+ if ( res ?. stdout && core . isDebug ( ) ) {
81+ core . startGroup ( `[stdout] ${ command } ` )
82+ core . debug ( res . stdout )
83+ core . endGroup ( )
84+ }
7685 }
77- return stdout
7886}
You can’t perform that action at this time.
0 commit comments