MCPcopy Create free account
hub / github.com/EvoMap/evolver / withPlatform

Function withPlatform

test/spawnReplacementProcess.test.js:47–55  ·  view source on GitHub ↗
(value, fn)

Source from the content-addressed store, hash-verified

45
46// Helper: temporarily override process.platform without leaking state.
47function withPlatform(value, fn) {
48 const desc = Object.getOwnPropertyDescriptor(process, 'platform');
49 Object.defineProperty(process, 'platform', { value, configurable: true });
50 try {
51 return fn();
52 } finally {
53 Object.defineProperty(process, 'platform', desc);
54 }
55}
56
57function withEnv(key, value, fn) {
58 const had = Object.prototype.hasOwnProperty.call(process.env, key);

Callers 1

Calls 1

fnFunction · 0.70

Tested by

no test coverage detected