Exception-safety fixes for 'syncProcess'.

(cherry picked from commit 4b38475f205730f96ca0e328dec95bb4d651c6a1)