opentap / OpenTap.Python

Python integration for OpenTAP
Apache License 2.0
22 stars 7 forks source link

Python plugin hijacks CancelKeyPress #92

Closed Denrask closed 1 year ago

Denrask commented 1 year ago

If I have Python plugin installed in my OpenTAP installation, then CTRL+C never triggers ICliAction cancellation.

namespace PythonHijacksMyProject
{
    [Display("python", Group: "ownedby", Description: "Insert description here")]
    public class MyCliAction : ICliAction
    {
        public int Execute(CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
                Thread.Sleep(250);

            return 0;
        }
    }
}

Without Python installed, CTRL+C as expected hits the "return 0" line. With Python installed, nothing happens when pressing CTRL+C.

Additional notes:

rmadsen-ks commented 1 year ago

Hi @Denrask, which version of the plugin are you using?

rmadsen-ks commented 1 year ago

Ok, I can verify this behavior. It was fixed in the past, but somehow this turns out to cause problems again.

Related: https://github.com/pythonnet/pythonnet/pull/777

The behavior with regards to init sigs seems to be correct, so it must be something else.

Denrask commented 1 year ago

Thank you, @rmadsen-ks !