Hatch shell gets confused after Ctrl-C and jumps between directories
After Ctrl-C'ing out of a hatch cli invoked from within a hatch shell, the shell gets confused and jumps between directories. This is on Windows in a CMD prompt.
Assume:
- hatch project in d:\hatch\mycli
- working dir in d:\workspace
cd d:\hatch\mycli
d:\hatch\project>hatch shell
(.hatch) d:\hatch\project>cd d:\workspace
(.hatch) d:\workspace> mycli command
command running...
KeyboardInterrupt
^C
(.hatch) d:\workspace> [press return]
d:\hatch\mycli [press return]
(.hatch) d:\workspace> [press return]
d:\hatch\mycli [press return]
(.hatch) d:\workspace> exit
(.hatch) d:\workspace> [press return]
(.hatch) d:\workspace> [press return]
(.hatch) d:\workspace> exit [window disappears]
#1647 is similar, but I wasn't sure if it was the same.
You first have this process tree:
└── command prompt 1
└── hatch shell
└── command prompt 2
└── mycli command
After Ctrl-C I think hatch shell quits, mycli command quits, and the others remain.
You get something like this, hierarchy gone, both prompts connected to standard in/outs:
└── command prompt 1
└── command prompt 2
This is likely something hatch shell could resolve. Either by not reacting to Ctrl-c (let prompt 2 handle it) or when hatch shell dies, make sure to take prompt 2 with it.
Maybe related to #1862 as well? I am seeing this in CMD and Powershell. Powershell get really messed up.