{"library":"ps-node","title":"Node.js Process Lookup Utility","description":"ps-node is a Node.js module designed for looking up and managing running processes across different operating systems. It leverages native system commands like `ps` on Linux/macOS and `wmic` on Windows to retrieve detailed process information, including PID, command, and arguments. The package, currently at version 0.1.6, was last published nine years ago. Its primary functionality includes searching for processes by PID or filtering by command and arguments using regular expressions. Additionally, it offers a `kill` function to terminate processes, supporting optional signals and timeouts. Due to its age, it does not support modern Node.js features like ECMAScript Modules (ESM) and is likely incompatible with recent Node.js versions or major operating system updates. There is no ongoing release cadence, and it is largely superseded by more actively maintained alternatives.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install ps-node"],"cli":null},"imports":["import ps from 'ps-node';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const ps = require('ps-node');\n\n// Look up processes matching a command and arguments\nps.lookup({\n    command: 'node',\n    arguments: '--debug'\n}, function(err, resultList) {\n    if (err) {\n        console.error('Error looking up processes:', err);\n        process.exit(1);\n    }\n\n    if (resultList.length === 0) {\n        console.log('No matching processes found.');\n        return;\n    }\n\n    console.log('Found matching processes:');\n    resultList.forEach(function(process) {\n        console.log('  PID: %s, COMMAND: %s, ARGUMENTS: %s', process.pid, process.command, process.arguments);\n    });\n\n    // Example: Kill the first found process after 5 seconds (for demonstration)\n    if (resultList[0]) {\n        const pidToKill = resultList[0].pid;\n        console.log(`\nAttempting to kill process ${pidToKill} in 5 seconds...`);\n        setTimeout(() => {\n            ps.kill(pidToKill, { signal: 'SIGTERM', timeout: 10 }, function(killErr) {\n                if (killErr) {\n                    console.error(`Error killing process ${pidToKill}:`, killErr);\n                } else {\n                    console.log(`Process ${pidToKill} has been killed!`);\n                }\n            });\n        }, 5000);\n    }\n});","lang":"javascript","description":"This quickstart demonstrates how to use `ps-node` to find running Node.js processes with specific debug arguments and then, as an example, attempts to terminate the first matching process.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}