extract sudo handling code into single function, fix #71
1.3.2