Fix :kill task on Unix
Further remove code duplication in tests