hatch icon indicating copy to clipboard operation
hatch copied to clipboard

Hatch shell gets confused after Ctrl-C and jumps between directories

Open peakschris opened this issue 1 year ago • 3 comments

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]

peakschris avatar Jul 22 '24 10:07 peakschris

#1647 is similar, but I wasn't sure if it was the same.

bluss avatar Jul 28 '24 14:07 bluss

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.

bluss avatar Jul 31 '24 12:07 bluss

Maybe related to #1862 as well? I am seeing this in CMD and Powershell. Powershell get really messed up.

ClintonLangerakPAVS avatar Oct 19 '25 21:10 ClintonLangerakPAVS