Fable: Ctrl+C or Ctrl+X doesn't kill subprocess initialized by Fable 3

Created on 19 Oct 2020  ·  11Comments  ·  Source: fable-compiler/Fable

Description

When I execute

dotnet tool restore && dotnet fable watch docs --run webpack-dev-server --config webpack.nagareyama.js

The compilation works OK but then if I want to restart the process, webpack tells me that the dev server is already in use.

Repro code

Clone Feliz repo and run

npm run start:nagareyama

Then try to restart it

Related information

  • Fable version: 3.0.0-nagareyama-alpha-014
  • Operating system: Windows 10

All 11 comments

Fixed as of 3.0.0-nagareyama-alpha-015

Actually this is still an issue as of 3.0.0-nagareyama-beta-002 I have to constantly end node.js processed from the task manager to able to get a fresh start 😢

I hope I got it right this time. Seems I had to use the Console.CancelKeyPressed event which took me a while to find. Can you please try with beta 3?

Works like a charm 😍

Unofortunately, a Node process still hangs for me in beta 3 after I CtrlC fake build -t run.

I'm using Powershell in Windows Terminal and have just updated to Webpack 5 and Webpack-cli 4 (meaning I now have to do fable watch src --run "webpack serve") if that's any help.

Yes, I did have problems with Webpack 5 and webpack-dev-server, webpack serve seems to work. Although you shouldn't need the quotations, Fable automatically gets anything after --run as the command. This is how fable-splitter worked (but we could change that before stable release if people find it confusing).

Hmm, this is gonna be tricky. I'm guessing that fake just kills the Fable process immediately and the CancelKeyPressed event is not raised, so either you manage the two processes (Fable and Webpack) through Fake or we ask the Fake team to terminate the Fable process by sending the cancel keys (not sure if this is just writing "Ctrl+C" into StandardInput or it's more involved).

I am not sure if this is a cross-platform concept but can Fable as a process listen to SIGTERM signal instead of a specific key-press? 🤔 It could also be that FAKE is not killing spawnd child processes so maybe the problem happens from there

Can Fable as a process listen to SIGTERM signal instead of a specific key-press?

Not sure, CancelKeyPressed is the only thing I found that works. But we had AssemblyLoadContext.Unloading at some point, maybe we need both as in here, I will give it a try: https://github.com/aspnet/Hosting/pull/876/files

@kerams I added a listener for the AssemblyContext.Unloading event in latest beta (5). Can you please try if it works?

Uh, now I can't reproduce it even with beta 1 🤦‍♂️

Was this page helpful?
0 / 5 - 0 ratings