正确的方式来终止postgres复制模式连接

我有下面的代码,使postgres 9.4中的逻辑解码:

pg_recvlogical -h localhost --slot test_slot --create-slot pg_recvlogical -h localhost --slot test_slot --start -f - 

我产生了一个node.jssubprocess来运行这个代码,并监听更改,但我不确定什么是正确的过程是终止连接。 我通常只是CNTRL+C或杀死代码中的子pg_recvlogical: unexpected termination of replication stream:但我总是得到一个pg_recvlogical: unexpected termination of replication stream:错误。 什么是终止这个连接的正确方法?