node-proper-lockfile icon indicating copy to clipboard operation
node-proper-lockfile copied to clipboard

Cannot kill debug client

Open wataash opened this issue 2 years ago • 1 comments

When this package is used, we can't exit node --inspect[-*] debug server with ctrl-C, or kill it with SIGTERM. This is due to https://github.com/tapjs/signal-exit/issues/71.

1$ # terminal 1: debug server
1$ cat index.js  # very simple script
console.log("a");

1$ node --inspect-brk index.js

2$ # terminal 2: debug client
2$ node inspect --port=9229
connecting to 127.0.0.1:9229 ... ok
Break on start in index.js:1
> 1 console.log("a");
  2 
debug> 

# terminal1
Debugger attached.
^C
1$ # killed with Ctrl-C

When proper-lockfile is used:

1$ cat index.js
const lockfile = require("proper-lockfile");
console.log("a");

1$ node --inspect-brk index.js

2$ node inspect --port=9229
connecting to 127.0.0.1:9229 ... ok
Break on start in index.js:1
> 1 const lockfile = require("proper-lockfile");
  2 console.log("a");
  3 
debug> n
break in index.js:2
  1 const lockfile = require("proper-lockfile");
> 2 console.log("a");
  3 

# now we can't kill the server!

# terminal1
Debugger attached.
^C^C^C^C^C

Tested environment:

  • Ubuntu 20.04 amd64
  • Linux kernel 5.15.39+
  • Node.js v16.18.1

wataash avatar Nov 18 '22 07:11 wataash

I think we should wait for https://github.com/tapjs/signal-exit/issues/71 to be responded in the meantime.

wataash avatar Nov 18 '22 07:11 wataash