Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pid-cwd

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pid-cwd

Get working directory of process by PID - cross platform

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pid-cwd

Node lib to get the current working directory of given process id - cross platform*

Usage

Install

$ npm i pid-cwd

Use

const pidCwd = require('pid-cwd');

pidCwd(54671)
    .then(cwd => {
        // A check is recommended, cwd could be null sometimes (read note below)
        console.log(cwd); // > /home/chipto/Dropbox
    });

Note

pid-cwd will simply return null if process doesn't exist, or process is owned by root/administrator or is unreachable or any other reason.
It won't throw any EPERM error or anything like that. It does throw if it can't recognize the OS or given pid is not a positive number.

* Works as long as process.platform === win32, linux or darwin.
   Throws if it's not one of those, in that case require manually from pid-cwd/lib/$1 where $1 is win, linux or macos

External Licenses

Massive thanks to Giampaolo Rodola' and contributors, for their amazing work on psutil

lib/win_pwdx/ contains 99.97% of code borrowed from psutil/arch/windows/process_info.c

psutil is BSD licensed, see psutil/LICENSE for more information.

Keywords

FAQs

Package last updated on 08 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc