@@ -6,7 +6,7 @@ import fix_up from "brewkit/porcelain/fix-up.ts"
66import { Command } from "cliffy/command/mod.ts"
77import fetch from "brewkit/porcelain/fetch.ts"
88import get_config , { platform_cache } from "brewkit/config.ts"
9- import { Path , hooks , utils } from "pkgx"
9+ import { Path , hooks , utils , Verbosity , verbosity } from "pkgx"
1010import * as YAML from "deno/yaml/mod.ts"
1111const { useConfig } = hooks
1212const { host } = utils
@@ -134,7 +134,23 @@ platform_cache(() => config.path.home).mkdir('p') // we’ve indeed found thing
134134
135135const proc = new Deno . Command ( script . string , { clearEnv : true , env} ) . spawn ( )
136136const rv = await proc . status
137- if ( ! rv . success ) throw new Error ( `UR BUILD FAILED WITH CODE ${ rv . code } & SIGNAL ${ rv . signal } ` )
137+ if ( ! rv . success ) {
138+ // If verbosity is debug (DEBUG=1, or GITHUB_ACTIONS=true with RUNNER_DEBUG=1), print config logs to aid diagnosis
139+ if ( verbosity >= Verbosity . debug ) {
140+ const wanted = new Set ( [ 'config.log' , 'CMakeError.log' , 'CMakeOutput.log' , 'meson-log.txt' ] )
141+ try {
142+ console . debug ( "\n==== CONFIG LOGS ====" )
143+ for await ( const [ path , { isFile } ] of config . path . build . walk ( ) ) {
144+ if ( isFile && wanted . has ( path . basename ( ) ) ) {
145+ console . debug ( `==== START ${ path } ====` )
146+ console . debug ( await path . read ( ) )
147+ console . debug ( `==== END ${ path } ====` )
148+ }
149+ }
150+ } catch ( err ) { console . warn ( "failed to read config logs:" , err ) }
151+ }
152+ throw new Error ( `UR BUILD FAILED WITH CODE ${ rv . code } & SIGNAL ${ rv . signal } ` )
153+ }
138154
139155/// move installation products to destination
140156await gum ( `rsync install to final path` )
0 commit comments