Unitech / Unitech/pm2

Using PM2 API to restart 'stopped' process returns javascript obj, while restarting 'online' process returns array of processes.

Open
#751 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T: Enhancement T: Question
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

This is a bug I've found with invoking PM2's API programatically.

Depending on the state of the process being restarted, the return data is of a different format (even though the documentation suggests differently here: https://keymetrics.io/2014/07/02/manage-processes-programmatically-with-pm2/

If you restart a process that's "online", you get back an array of processes. [{process}] - pm2.restart(id, fn)
If you stop that process, you get back an array of processes. [{process}] - pm2.stop(id, fn)
If you then restart the process again, you get back an obj which is that process. {process} - pm2.restart(id, fn)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented pm2.restart and pm2.stop API calls for processes in the online and stopped states, comparing the callback return values. Use the linked programmatic-management documentation as the expected reference; done means the restart result has one consistent documented format across both states.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.