A runaway railway trolley hurtled along a track for more than half a mile (0.8km), narrowly avoiding a group of rail workers.