MCPcopy Index your code
hub / github.com/nodejs/node / lazySpawn

Function lazySpawn

test/parallel/test-aborted-util.js:67–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65
66let spawn;
67function lazySpawn() {
68 if (spawn === undefined) {
69 try {
70 spawn = require('child_process').spawn;
71 } catch {
72 // Ignore if spawn does not exist.
73 }
74 }
75 return spawn;
76}
77
78test('Does not hang forever', { skip: !lazySpawn() }, async () => {
79 const { promise, resolve } = Promise.withResolvers();

Callers 1

Calls 1

requireFunction · 0.50

Tested by

no test coverage detected