const wakeUp = async () => Promise.resolve('I am up') const ownerUp = async () => Promise.resolve('Owner is up') const meow = () => console.log('MEOW') const repeat = () => Promise.any([ownerUp(), process.nextTick(morning())]) .then(() => process.exit(0)) export const morning = () => wakeUp() .then(meow) .then(repeat)