Skip to content

[BUG] /tmp/npm-${PID}-* directories should be cleaned when "npm pack" gets terminated #695

Closed
@AlexanderSamoilov

Description

@AlexanderSamoilov

What / Why

"npm pack" call produces junk data in the system temp (smth like /tmp/npm-8452-4aa95566). This useless data quickly populates the /tmp and puts responsibility on npm users to clean it. I think the responsibility to remove this data should be on npm code, because npm code produces there intermediate directories. I think it is not a big deal to add a removal upon exiting of the npm process.

UPDATE: I am talking about the case "npm pack" failed and did not clean the folder. There should be some error handling added so that npm cleans the temp folder before gets abnormally terminated.

I assume that the place where this path is evaluated is probably ./lib/npm.js, thus probably the removal can be added to this script:
Object.defineProperty(npm, 'tmp',
{
get: function () {
if (!tmpFolder) tmpFolder = 'npm-' + process.pid + '-' + rand
return path.resolve(npm.config.get('tmp'), tmpFolder)
},
enumerable: true
})

OS: Ubuntu 18.04
NPM: 6.5.0

When

Whenever "npm pack" fails.

Where

npm publish

How

Current Behavior

  • n/a

Steps to Reproduce

  • n/a

Expected Behavior

  • n/a

Who

  • n/a

References

  • n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions