foreground is getting stdin correctly