File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -322,14 +322,14 @@ async function mergeScreenRecords(mediaFiles) {
322322 * @returns {Promise<boolean> }
323323 */
324324async function terminateBackgroundScreenRecording ( adb , force = true ) {
325- const pids = ( await adb . getPIDsByName ( SCREENRECORD_BINARY ) ) . map ( ( p ) => ` ${ p } ` ) ;
326- if ( _ . isEmpty ( pids ) ) {
325+ const isScreenrecordRunning = async ( ) => _ . includes ( await adb . listProcessStatus ( ) , SCREENRECORD_BINARY ) ;
326+ if ( ! await isScreenrecordRunning ( ) ) {
327327 return false ;
328328 }
329329
330330 try {
331- await adb . shell ( [ 'kill ' , force ? '-15' : '-2' , ... pids ] ) ;
332- await waitForCondition ( async ( ) => _ . isEmpty ( await adb . getPIDsByName ( SCREENRECORD_BINARY ) ) , {
331+ await adb . shell ( [ 'killall ' , force ? '-15' : '-2' , SCREENRECORD_BINARY ] ) ;
332+ await waitForCondition ( async ( ) => ! await isScreenrecordRunning ( ) , {
333333 waitMs : PROCESS_SHUTDOWN_TIMEOUT ,
334334 intervalMs : 500 ,
335335 } ) ;
You can’t perform that action at this time.
0 commit comments