Skip to content

Calling process.cwd() from index.js can be problematic #45

@ohz10

Description

@ohz10

The following line in index.js can crash some node apps.

var basePath = process.cwd()

This line in index.js is problematic for some node applications that might get invoked from a directory that has been removed by another process.

The application may not actually need the current working directory, but it never gets a chance to run because node barfs if depd is a dependency of anything pulled in with a requires statement.

I haven't looked into why you need this, but maybe __filename or __dirname would be more appropriate here? Since it would be hard to execute a node app that didn't exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions