scripting – Exit Wolframscript by Ctrl+C without interrupt prompt

How can a Wolframscript be terminated by Ctrl+C without yielding the Interrupt prompt (see e.g. here)? Unfortunately, this self-proclaimed hack causes a segmentation fault in Mathematica 12.3.1 under Linux.

Here is a concrete example where this problem arises and would benefit from a proper solution. Suppose you have a Wolframscript running a server.

#!/usr/bin/env wolframscript
SocketListen({ip, port}, handler);
While(True, Pause(10));

Pressing Ctrl+C brings up the interrupt prompt. Clearly, the last line of this script – which is supposed to express “wait forever until interrupted” – is also rather ugly.

Can this be properly solved using Tasks? Any suggestions are welcome.