Skip to content

global.key assigned value 'async' as a result of shell.exec(...) #12

@michaelsbradleyjr

Description

@michaelsbradleyjr

I recently integrated shelljs into one of my projects and mocha started complaining about a global leak with respect to a key property being set on the global object.

I can reproduce the effect in the REPL, i.e. independently of the project in question:

$ node
> var shell = require('shelljs');
undefined
> global.key
undefined
> shell.exec('ls -lad *');
{ code: 0,
  output: ... }
> global.key
'async'

If this is an expected behavior, it might be good to document it in shelljs's README, as it took me a little while to figure out that I hadn't caused the "leak" with a statement in my own code. I imagine it may trip up other folks as well.

Is it a bug perhaps?

By the way, many thanks for creating shelljs. I ran into a situation recently where I just had to have a way to make a synchronous http request. Using shelljs to synchronously invoke another node script which makes the request asynchronously ended up being a far simpler solution than introducing fibers or hand-rolling a C addon.

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