Fix broken non-interactive runs

Since 1d360bd9a98979db563d38ac5f15607d13cac61b, status_code was always
None when not running interactively.