Prior to this fix, if job control is enabled but stdin is not a tty, we would return an error from terminal_maybe_give_to_job which would cause us to avoid waiting for the job. Instead just return notneeded. Fixes #6573.