Runs and shuts off

Also check fuel filter. Could be getting fuel until something gets sucked into filter and shut fuel flow down. Once the car sits the trash clears the filter and lets gas through.