  The process that allows cosmic rays to escape from their sources and be
released into the Galaxy is still largely unknown. The comparison between
cosmic-ray electron and proton spectra measured at Earth suggests that
electrons are released with a spectrum steeper than protons by $\Delta s_{\rm
ep} \sim 0.3$ for energies above $\sim 10$ GeV and by $\Delta s_{\rm ep} \sim
1.2$ above $\sim 1$ TeV. Assuming that both species are accelerated at
supernova remnant shocks, we here explore two possible scenarios that can in
principle justify steeper electron spectra: (i) energy losses due to
synchrotron radiation in an amplified magnetic field, and (ii) time dependent
acceleration efficiency. We account for magnetic field amplification produced
by either cosmic-ray induced instabilities or by magneto-hydrodynamics
instabilities my means of a parametric description. We show that both
mechanisms are required to explain the electron spectrum. In particular
synchrotron losses can only produce a significant electron steepening above
$\sim 1$~TeV, while a time dependent acceleration can explain the spectrum at
lower energies if the electron injection into diffusive shock acceleration is
inversely proportional to the shock speed. We discuss observational and
theoretical evidences supporting such a behaviour. Furthermore, we predict two
additional spectral features: a spectral break below $\sim$ few GeV (as
required by existing observations) due to the acceleration efficiency drop
during the adiabatic phase, and a spectral hardening above $\sim 20$ TeV (where
no data are available yet) resulting from electrons escaping from the shock
precursor.
