Skip to content

Commit

Permalink
* (bluefox) Added support for the once mode
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Apr 14, 2024
1 parent 4b832bb commit c53844e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46

## Changelog
<!-- ### **WORK IN PROGRESS** -->
### **WORK IN PROGRESS**
* (bluefox) Added support for the once mode

### 1.0.10 (2024-04-10)
* (bluefox) Added support for vis-2 testing

Expand Down
28 changes: 26 additions & 2 deletions setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,27 @@ function startCustomAdapter(adapterName, adapterInstance) {
stdio: [0, 1, 2, 'ipc'],
});
}
pids[id].on('exit', (code, signal) => {
if (pids[id]) {
console.log(`child process terminated 1 due to receipt of signal ${signal}`);
let resolve = pids[id].customResolve;
if (resolve) {
delete pids[id].customResolve;
}
pids[id] = null;
resolve && resolve();
}
});
pids[id].on('close', () => {
if (pids[id]) {
let resolve = pids[id].customResolve;
if (resolve) {
delete pids[id].customResolve;
}
pids[id] = null;
resolve && resolve();
}
});
} catch (error) {
console.error(JSON.stringify(error));
}
Expand Down Expand Up @@ -853,16 +874,19 @@ function stopCustomAdapter(adapterName, adapterInstance) {
} else {
adaptersStarted[id] = false;
return new Promise(resolve => {
pids[id].customResolve = resolve;
pids[id].on('exit', (code, signal) => {
if (pids[id]) {
console.log(`child process terminated due to receipt of signal ${signal}`);
console.log(`child process terminated 3 due to receipt of signal ${signal}`);
delete pids[id].customResolve;
pids[id] = null;
resolve();
}
});

pids[id].on('close', (/* code, signal */) => {
pids[id].on('close', () => {
if (pids[id]) {
delete pids[id].customResolve;
pids[id] = null;
resolve();
}
Expand Down

0 comments on commit c53844e

Please sign in to comment.