On October 14, 2025 9:40:45 PM UTC, David Barsky <[email protected]> wrote:
>> If testing is all scripted, then why not put "pg_ctl stop" at the end of
>the script?
>
>Sorry for the delay.
>
>It’s _mostly_ scripted, but two major reasons:
>
>1. If that script is cancelled or interrupted for any reason, it’s possible
>that
>   `pg_ctl stop` won't be called and I'd have a leaked process.

bash has EXIT trap you can use to run functions even in the case of interrupts; 
You can create a wrapper script if its not written in bash.

 I could
>mitigate
>   this by calling `pg_ctl stop` at the *start* of the script, but that
>adds a
>   bit of latency I'd prefer to avoid.

You could also run pg_ctl stop in the background (i.e. in another process). 
Again, if using bash, you just add & at the end. It should be possible to 
create processes in any scripting language.


Reply via email to