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

No such process found! #7

Closed
rahilwazir opened this issue Sep 21, 2015 · 34 comments
Closed

No such process found! #7

rahilwazir opened this issue Sep 21, 2015 · 34 comments

Comments

@rahilwazir
Copy link

Following the code:

let childWorker = cp.fork(`${__dirname}/../somefile`);

console.log(childWorker.pid);
// 12345

ps.lookup({ pid: childWorker.pid }, (err, resultList) => {
    console.log(resultList);
    // []
});

Why it didn't work? I also randomly picked pid from ps -A and it still didn't work.

@IstoraMandiri
Copy link

Weird, I am also having this issue. It just doesn't work!

ps.lookup {command: 'node'}, (err,res) ->
  console.log 'ps.lookup', err, res # always null, []

OSX 10.10

@jamietre
Copy link

jamietre commented Oct 6, 2015

This doesn't work at all for me in Winows either. No processes are ever returned.

@sleman
Copy link

sleman commented Oct 21, 2015

I believe issue is with the TableParser.parse method.

On Mac, I run ps and I get:
/Users/bin/ffmpeg-f:v mpegts -fflags nobuffer -probesize 18192 -i udp://8.8.8.8:9000 -ignore_unknown -vf fps=20 /tmp/

However, when running ps.lookup, that process isn't found.

IstoraMandiri added a commit to IstoraMandiri/table-parser that referenced this issue Oct 31, 2015
@IstoraMandiri
Copy link

@sleman you're correct - it seemed to be a problem with TableParse - it wasn't parsing the PID correctly

@neekey please see neekey/table-parser#3 any comment?

IstoraMandiri added a commit to IstoraMandiri/meteor-embark that referenced this issue Oct 31, 2015
@neekey
Copy link
Owner

neekey commented Nov 4, 2015

Hi, guys, I'm sure this is caused by neekey/table-parser#3 , I will fix it soon.

@ricovitch
Copy link

Does not work for me on windows.
I see @hitchcott made a patch, but i prefer to seek for another solution.

Actually there is this forked version that seems to work : https://www.npmjs.com/package/ps-nodejs

@codeandcats
Copy link

Yep TableParse is the issue. It is expecting line endings to be \n when they can be \r (even on windows).

@leegee
Copy link

leegee commented Mar 15, 2016

👍

@jamietre
Copy link

Or just use sindre sorhus' package which works: https://github.com/sindresorhus/ps-list

I'm all for alternatives, but this code has been broken since I first tried it 6 months ago. You should make a note in the readme that it doesn't work so people don't keep wasting time, until if/when it is fixed.

@codeandcats
Copy link

Awesome, thanks for the suggestion @jamietre!

@leegee
Copy link

leegee commented Mar 15, 2016

On the table-parser issue page, nfantone commented on 2 Jan this year, ps-node doesn't even need a table parser. Thanks, @jamietre, for your suggestion - I'll try that.

@yetzt
Copy link

yetzt commented Apr 6, 2016

i noticed, i don't get a result when calling with an interger as pid paremeter, but converting it to a string it works just well.

i looked into the code and at

// 若限定了id列表
if( idList && idList.indexOf( String( p.pid ) ) < 0 ){
  return;
}

you are casting p.pid as a string and then matching it with an array that may (and with regards to your sample code should) hold integers. PR is underway.

yetzt added a commit to yetzt/ps that referenced this issue Apr 6, 2016
@yetzt
Copy link

yetzt commented Apr 7, 2016

ping @neekey.

@yetzt
Copy link

yetzt commented Apr 13, 2016

well, i sent @neekey an email, but so far no response. i implemented the functionality i needed myself in this module, feel free to use it.

@PaulTerryGameDev
Copy link

Does this work for Windows 10 64-bit?

@PaulTerryGameDev
Copy link

(It doesn't seem to work for me in Windows 10 64-bit..is not finding any processes by ID (using the first example in the help)

@yetzt
Copy link

yetzt commented Apr 15, 2016

@PaulTerryGameDev this uses the ps command found on unix operating systems. you could write something that uses tasklist and parse it's output.

@neekey neekey closed this as completed in #9 Apr 26, 2016
@neekey neekey reopened this Apr 26, 2016
@neekey
Copy link
Owner

neekey commented Apr 26, 2016

Sorry guys! I'm back! I just rewrite table-parser with connected-domain, and I create a new branch of PS using the latest version of table-parser.

The parser problem should be fixed, but I need you to help me test with it, install it through github:

npm install https://github.com/neekey/ps.git#0.1.0

@yetzt your PR is included

@PaulTerryGameDev I haven't got a chance to try win 10, can you open a new issue for it?

@neekey
Copy link
Owner

neekey commented May 4, 2016

Hi guys, I have published version 0.1.0, and I will focus on these two issues( neekey/table-parser#4, #10 ) ,feel free to reopen this issue if you encounter any problem related.

@neekey neekey closed this as completed May 4, 2016
@Luiz-N
Copy link

Luiz-N commented May 6, 2016

I'm having this issue now with latest version

@neekey
Copy link
Owner

neekey commented May 7, 2016

Hi @Luiz-N, could you please provide more details like:

  • your OS version
  • NodeJS version
  • the code you were running

thank you

2016年5月7日星期六,Luiz-N [email protected] 写道:

I'm having this issue now with latest version


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#7 (comment)

发自移动版 Gmail

@cloudtaxi
Copy link

cloudtaxi commented May 12, 2016

I have the same issue with latest version

└── [email protected]
ps.lookup({ pid: '20505' }, 

[root@bigbn site]# node ets.js 
No such process found!
[root@bigbn site]# node --version
v6.1.0
[root@bigbn site]# uname -a
Linux bigbn 4.5.2-1-ARCH #1 SMP PREEMPT Thu Apr 21 18:21:27 CEST 2016 x86_64 GNU/Linux
[root@bigbn site]# ps -p 20505 -o %cpu,%mem
%CPU %MEM
0.0  0.0

I'm using code from first example with my existsting pid

@neekey
Copy link
Owner

neekey commented May 13, 2016

@cloudtaxi ps-node has already passed test on Mac and Linux through https://travis-ci.org/neekey/ps, and I tested it with NodeJS 6.1.0 on my Mac, it works. Can you install the latest version of 0.1.1, run its test cases with npm test and tell me the result ?

Thank you

@breezewish
Copy link

breezewish commented May 29, 2016

I have the same issue as @cloudtaxi . npm test are passed.

  1. in OS X: ps l will not return a full list of processes.
  2. ps aux works, however the columns are incorrectly-mapped, may due to Chinese characters

@breezewish
Copy link

It may be much more easy to parse result if you use formatted output as https://github.com/yibn2008/find-process/blob/master/lib/find_process.js#L27

@neekey
Copy link
Owner

neekey commented May 31, 2016

@summerwish if your problem is caused by multiple-byte characters, then it is a know issue with table-parser neekey/table-parser#4

However, the link you provided does not help much as you can see from the manual for ps:

-w      Use 132 columns to display information, instead of the default which is your window size.  If the -w option is specified more than once, ps will use as many columns as necessary without regard for your
             window size.  When output is not to a terminal, an unlimited number of columns are always used.
-o      Display information associated with the space or comma separated list of keywords specified.  Multiple keywords may also be given in the form of more than one -o option.  Keywords may be appended with
             an equals (`=') sign and a string.  This causes the printed header to use the specified string instead of the standard header.  If all keywords have empty header texts, no header line is written.

-w and -o really do not help to solve this problem, and to be honest, I do not have a good idea to deal with it right now. But you can avoid this problem by not using option "u" ( notice not "-u", "u" means to show detailed information, which will include a STARTED field, which may be output as local string ) or "-f" which quite does the same thing.

Another idea I just came out is maybe there's a way I can enforce the PS command to output a specified language like English, but I am not sure if it can be done.

How this can give you a little help : )

@breezewish
Copy link

Hi, thanks for your explanation! How about just split each row by whitespace? Since you can use -o to put the arg column as the last column and project only part of the columns, other columns should not contain any whitespace.

@neekey
Copy link
Owner

neekey commented May 31, 2016

@summerwish the situation is much more complicated than you may have thought, for example, for some rows their certain field may be blank, and another case is that for COMMAND filed, they will include space to separate their command and arguments like:

System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker -s mdworker -c MDSImporterWorker -m com.apple.mdworker.single

and in windows you may not be able to control the position for COMMAND field, and not even in some case you will encounter strings like below:

"hello world"

Hope this makes sense to you

@breezewish
Copy link

Besides, ux breaks this utility in OS X:

ps.lookup({ psargs: 'ux' }, ...);

outputs:

{ pid: 'Breezewish',
    command: 'node',
    arguments: [ 't.js' ],
    ppid: undefined }

which is not correct

@breezewish
Copy link

Wow. Windows is a problem that I didn't considered :(

@MikiDavid
Copy link

MikiDavid commented Jun 7, 2016

Hi @neekey,

I had this issue now:

Attempt to found an active process by its name: NearoHostServer.exe - Fail each time and got [].
When at command I write nearohostserver.exe - Works like a charm and giving back the details.

My code:
Working:

var ps = require('ps-node');

ps.lookup({
    command: 'nearohostserver.exe',
    arguments: ''   
}, function(error, resultList){
    console.log(resultList);
        // [ { pid: '1104',
        // command: 'c:\\program files (x86)\\mce-100\\nearohostserver.exe',
        // arguments: [ '5F975E550A3FD20DDCA48B38EAF586F2', '/worker' ],
        // ppid: undefined } ]
})

Not Working:

var ps = require('ps-node');

ps.lookup({
    command: 'NearoHostServer.exe',
    arguments: ''   
}, function(error, resultList){
    console.log(resultList);
        // []
})

Windows 10 x64, table-parser version 0.1.1, ps-node version 0.1.1.
On other PCs at my organization, its working with capital letter, only at mine its not working.

@neekey
Copy link
Owner

neekey commented Jun 7, 2016

@MikiDavid thanks for submiting this bug, it seems like a problem caused by string matching, should be fixed easily.

@neekey
Copy link
Owner

neekey commented Jun 23, 2016

@MikiDavid I just published 0.1.2, it should fix this bug.

@xmsz-stu
Copy link

xmsz-stu commented Sep 3, 2023

not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests