Without these changes, kak would hang on the corresponding commands, displaying a 'waiting for shell command to finish' message.
Closes #2783