Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add crash-dump-report server demo of nodejs #7959

Open
wants to merge 2 commits into
base: nw68
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/sanity/crash-dump-report/crash_server.js/README.md
@@ -0,0 +1,23 @@
# a simple nwjs crash server of nodejs

## Test step

```sh
npm i -g @licq/tnwjs
tnw install 0.67.1 # or 0.57.1


npm i
# start server
npm run server
# start nwjs
npm run app
```

## Clear the NW.js processes

> When NW.js crashed, for some old NW.js version(eg: 0.57.1), you should manually clear the NW.js processes

```sh
npm run clear
```
19 changes: 19 additions & 0 deletions test/sanity/crash-dump-report/crash_server.js/kill_nw.js
@@ -0,0 +1,19 @@
/**
* clear the NW.js process for old nwjs version
* @author ostwindli
*/
const cp = require("child_process");
const exeStr = `ps -ef | grep nwjs | grep -v grep|awk '{print $2}'`;
(async function () {
let pids = cp.execSync(exeStr).toString().split(/\n/);
pids = pids.filter((pid) => pid);
pids
.map((pid) => {
return parseInt(pid);
})
.forEach((pid) => {
process.kill(pid, "SIGTERM");
});

pids.length && console.log(`clean nw pids: `, pids);
})();