@@ -140,31 +140,37 @@ export async function readFileSystems(): Promise<FSUsage[]> {
140140 Gio . SubprocessFlags . STDOUT_PIPE
141141 ) ;
142142 proc . communicate_utf8_async ( null , null ) . then ( ( [ stdout ] ) => {
143- const output = stdout as unknown as string ;
144- const lines = output . split ( '\n' ) ;
145- for ( const line of lines ) {
146- const m = line . match ( RE_DF_IS_DISK ) ;
147- if ( m ) {
148- const details = m [ 2 ] . match ( RE_DF_DISK_USAGE ) ;
149- if ( details ) {
150- const dev = m [ 1 ] ;
151- const cap = parseInt ( details [ 1 ] ) * 1024 ;
152- const used = parseInt ( details [ 2 ] ) * 1024 ;
153- const mount = details [ 5 ] ;
154- let fileSystem = new FSUsage ( dev , cap , used , mount ) ;
155- if ( fileSystems . has ( dev ) ) {
156- const old = fileSystems . get ( dev ) ;
157- if ( old && old . mount . length < mount . length ) {
158- // Only report one mount per device; use the shortest file path
159- fileSystem = old ;
143+ // Try to process the output even if the exit status != 0
144+ if ( stdout ) {
145+ const output = stdout as unknown as string ;
146+ const lines = output . split ( '\n' ) ;
147+ for ( const line of lines ) {
148+ const m = line . match ( RE_DF_IS_DISK ) ;
149+ if ( m ) {
150+ const details = m [ 2 ] . match ( RE_DF_DISK_USAGE ) ;
151+ if ( details ) {
152+ const dev = m [ 1 ] ;
153+ const cap = parseInt ( details [ 1 ] ) * 1024 ;
154+ const used = parseInt ( details [ 2 ] ) * 1024 ;
155+ const mount = details [ 5 ] ;
156+ let fileSystem = new FSUsage ( dev , cap , used , mount ) ;
157+ if ( fileSystems . has ( dev ) ) {
158+ const old = fileSystems . get ( dev ) ;
159+ if ( old && old . mount . length < mount . length ) {
160+ // Only report one mount per device; use the shortest file path
161+ fileSystem = old ;
162+ }
160163 }
164+ fileSystems . set ( dev , fileSystem ) ;
161165 }
162- fileSystems . set ( dev , fileSystem ) ;
163166 }
164167 }
165-
166168 resolve ( Array . from ( fileSystems . values ( ) ) ) ;
167169 return ;
170+ } else {
171+ console . warn ( '[TopHat] Could not run df -P: ' ) ;
172+ reject ( 'Could not run df -P' ) ;
173+ return ;
168174 }
169175 } ) ;
170176 } catch ( e ) {
0 commit comments