Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to get process parent, name and list of processes. #42912

Open
bsutton opened this issue Aug 2, 2020 · 0 comments
Open

Added ability to get process parent, name and list of processes. #42912

bsutton opened this issue Aug 2, 2020 · 0 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-enhancement A request for a change that isn't a bug

Comments

@bsutton
Copy link

bsutton commented Aug 2, 2020

I'm the author of dshell which provides a library for building cli apps with dart.

https://github.com/bsutton/dshell/

One of the core drivers is to replace bash with dart.

When building these types of apps a common operation is to get details of a running process.

Specifically

A list of running processes.
The name of an existing process
The parent pid of of a process [the more specialised use case is the parent of the current process].

I'm currently doing this by calling out to 'tasklist' on windows and 'ps' under linux.
The problem is these methods are not reliable (particularly under linux) as not all distros have the required tooling.
For example we do a lot of work in docker containers and the availability of 'ps' is not the norm.

My suggestion would be something like:

class Process
{
static List<Process> Process.list();

Process  get parent ();

Process get forPid(int pid);

String get name;

/// less important but useful.

bool get isRunning;

/// returns the path to the exec that started the process.
String get path;


}

Having these methods in the core sdk would make this work far easier.

Dart VM version: 2.8.4 (stable) (Unknown timestamp) on "linux_x64"
@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-enhancement A request for a change that isn't a bug labels Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants