/git-bash-lifecycle-script-test

Trying to isolate a lifecycle script bug in Git-Bash

Git-Bash post{script} lifecycle script test

Goal

Isolate why some long-running scripts in Git-Bash trigger post{script} lifecycle scripts after being killed with control-c while others do not.

This is a problem when running the ideasonpurpose/docker-build start script since it leaves behind an orphaned Docker instance which much be killed manually.

Setup

The usual: npm install

Tests

There are four scripts, each of which has an accompanying post{script} that simply echoes its name.

Killing long-running scripts with control-c should trigger the post{script}, but sometimes fails.

npm run echo

This is just a simple control which prints echo script, then triggers postecho which prints postecho script.

npm run pyserver

This uses cross-env-shell to start a python3 webserver on port 8000. The postpyserver script fails to run after killing this with control-c.

npm run server

Runs http-server which listens on port 8080. Killing this should trigger postserver which echoes its name.

npm run watch

This starts a chokidar file watcher in the current directory. The postwatch script fails to run after killing this with control-c.

Notes

This only seems to be an issue with Git-Bash for some long-running processes. Post{script} lifecycle scripts work correctly from cmd.exe and Powershell, the same as they do on Mac/Linux.

Related issues

These may be relevant: