-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't trigger events when module (environment) is terminating.
- Loading branch information
1 parent
99712aa
commit 61da93b
Showing
7 changed files
with
117 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as zmq from "../../src" | ||
|
||
import {assert} from "chai" | ||
import {createProcess, uniqAddress} from "./helpers" | ||
|
||
describe("socket process exit", function() { | ||
it.skip("should occur cleanly when sending in exit hook", async function() { | ||
this.slow(200) | ||
const code = await createProcess(async () => { | ||
const sockA = new zmq.Pair | ||
const sockB = new zmq.Pair | ||
await sockA.bind("inproc://test-1") | ||
sockB.connect("inproc://test-1") | ||
|
||
process.on("exit", () => { | ||
console.log("hook") | ||
sockB.receive() | ||
sockA.send("foo") | ||
}) | ||
}) | ||
|
||
assert.equal(code, 0) | ||
}) | ||
|
||
it("should occur cleanly when reading events", async function() { | ||
this.slow(200) | ||
const code = await createProcess(() => { | ||
const sock = new zmq.Dealer | ||
|
||
async function readEvents() { | ||
const events = [] | ||
for await (const event of sock.events) { | ||
events.push(event) | ||
} | ||
} | ||
|
||
readEvents() | ||
}) | ||
|
||
assert.equal(code, 0) | ||
}) | ||
}) |