import Debug from 'debug' ; const debug = Debug ( 'plugin-bash-like/fs/initDone' ) ; const initDones = [ ] ; export function pushInitDone ( initDone , placeholderMountPath ) { initDones . push ( { initDone , placeholderMountPath } ) ; return initDone ; } export async function waitForMountsToFinish ( filepath ) { const waitForThis = initDones . find ( _ => filepath . startsWith ( _ . placeholderMountPath ) || filepath === _ . placeholderMountPath + '/' ) ; if ( waitForThis ) { debug ( 'waiting for mount' , waitForThis . placeholderMountPath ) ; await waitForThis . initDone ; debug ( 'waiting for mount: done!' , waitForThis . placeholderMountPath ) ; } }