"every man jack" might have -wanted- to shoot deserters, under the conditions at the time but, in my opinion, would not have done so without the express orders of the nearest available officer. That is if they'd applied any of their ample time of idleness to thinking through the consequences of acting without such orders.
At the civilian level, it would simply be treated as murder. At the military level, there may be enhnacements like 'aiding the enemy', bordering on treason, to be added to whatever punishments they handed out for murdering one of their own. Somewhat academic when it's the death penalty, either way.
Anyway, my inexpert view is that the Military is an arm of the State and, therefore, Military Law supercedes Civil Law - at least in this specific case where the State was at War and the soldier commits an offence at the front lines which placed their (sleeping, vulnerable) colleagues in genuine peril.
The irony is not lost on me with regard to the part where the Army command structure aided the enemy by shooting hundreds, if not thousands of their own men for the above reasons.
It wasn't right and it wasn't fair but we have no way of knowing or computing how events would have panned out if they'd been lenient, discipline became lax, guards fell asleep routinely and battles were lost as a consequence. Tens of thousands more lives could have been lost as a result of losing territory and winning it back again.