COMMUNITY

neko2.1:How to get PID of the current process


(Mr Zhan) #1

neko2.1:How to get PID of the current process? are there any api about that ?


(Phil Chertok) #2

It’s currently not possible with the existing API. You might be able to figure it out using Sys.command but that would involve platform specific code.


(Mr Zhan) #3

I try to use python to get this function.


(Brian Tiffin) #4
/**
 Show current pid

 Tectonics:
   nekoc getpid.neko
   neko getpid
*/

var sys_get_pid = $loader.loadprim("std@sys_get_pid", 0);

$print(sys_get_pid());

I’m pretty sure this was added in NekoVM 1.4.5, according to the CHANGES file, way back in aught 6; before my time. :slight_smile:

https://nekovm.org/doc/view/sys/ last item.

To put a more positive spin on this thread outcome. Neko has many (almost) secret powers (until you bump into the right hint).

Have good, make well