Yes, that's weird issue, copy command works fine with debugger on and fails without debugger.
I used below code to check the status of copy command.
try{var status = document.execCommand('copy'); console.log('Copying text command was '+ (status ? 'successful':'unsuccessful')); }catch(err){ alert('Oops, unable to copy to clipboard');}