Found myself a solution. And probably the cause of the issue. shell() doesn't expect a null-terminated string, but just a string with the shell command without any newlines or nulls.
So I can do this (importing std.algorithm for until): auto command = to!string(chBuffer[].until('\n')); auto result = shell(command); Not too shabby. Still that error message wasn't of much help. shell() internally creates a temp file with a random file name, temporarily redirects stdout to that file to catch the contents of a system() invocation, and then reads that file with readtext(). Somehow, something errors out if there's a newline or null in the string, and it all explodes with a weird error message.