Skip to content

Support for hooking spawn / spawnSync without patching.Β #48

@coreyfarrell

Description

@coreyfarrell

By default nyc 15 will be using node-preload instead of spawn-wrap. v0.1.x was fine for nyc's specific use case but I do not believe it's generic enough to be part of node.js. In particular it did not support alteration of variables (prepending / appending an existing value) nor does it allow control over conditional variable propagation (setting a variable only if it doesn't already exist).

I've created process-on-spawn. I think this may be generic enough to serve any situation where the environment of child processes must be centrally manipulated/controlled. This new module does not have direct support for propagating variables to grand-child processes and it doesn't help with adding --require options to NODE_OPTIONS. I've altering node-preload to use process-on-spawn instead of directly patching spawn / spawnSync functions, so the two modules work together.

My hope is to work towards getting the functionality of process-on-spawn into node.js so nyc can eventually avoid patching spawn / spawnSync.

Ref nodejs/node#27344
CC @bcoe

Edit: I've renamed the module to process-on-spawn which provides an options object to listener functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions