Re: How to list all process directories under /proc/

2017-09-22 Thread angel via Digitalmars-d-learn
On Sunday, 17 September 2017 at 08:15:58 UTC, Ky-Anh Huynh wrote: Hi, I want to list all processes by scanning /proc/. The following code doesn't work [code] foreach (string fstatm; dirEntries("/proc/", "[0-9]*", SpanMode.shallow)) { writefln("pid %s", fstatm); } [/code] as it

Re: How to list all process directories under /proc/

2017-09-19 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 18:32:06 UTC, Matt Jones wrote: On Tuesday, 19 September 2017 at 13:32:29 UTC, Ky-Anh Huynh wrote: Btw, is that a bit weird that range is not supported in glob pattern :) Is there a design reason for this? That is strange. But then again, every glob

Re: How to list all process directories under /proc/

2017-09-19 Thread Matt Jones via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 13:32:29 UTC, Ky-Anh Huynh wrote: Btw, is that a bit weird that range is not supported in glob pattern :) Is there a design reason for this? That is strange. But then again, every glob library I've seen works a little bit differently.

Re: How to list all process directories under /proc/

2017-09-19 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 06:35:18 UTC, Matt Jones wrote: On Sunday, 17 September 2017 at 08:37:33 UTC, Ky-Anh Huynh wrote: [...] The problem with matching "[0123456789]*" is that it will match files like "1blah" and "8stuff". It looks like glob patterns are not robust enough to

Re: How to list all process directories under /proc/

2017-09-19 Thread Matt Jones via Digitalmars-d-learn
On Sunday, 17 September 2017 at 08:37:33 UTC, Ky-Anh Huynh wrote: The official documentation here https://dlang.org/phobos/std_path.html#.globMatch refers to the wiki page https://en.wikipedia.org/wiki/Glob_%28programming%29 . However I think the popular glob rules (man 7 glob) are not

Re: How to list all process directories under /proc/

2017-09-17 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Sunday, 17 September 2017 at 08:32:24 UTC, Ky-Anh Huynh wrote: My bad. Range doesn't support. The correct pattern is [code] foreach (string fstatm; dirEntries("/proc/", "[0123456789]*", SpanMode.shallow)) { writefln("pid %s", fstatm); } [/code] Is there a way to make this

Re: How to list all process directories under /proc/

2017-09-17 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Sunday, 17 September 2017 at 08:15:58 UTC, Ky-Anh Huynh wrote: Hi, I want to list all processes by scanning /proc/. The following code doesn't work [code] foreach (string fstatm; dirEntries("/proc/", "[0-9]*", SpanMode.shallow)) { writefln("pid %s", fstatm); } [/code] as it

How to list all process directories under /proc/

2017-09-17 Thread Ky-Anh Huynh via Digitalmars-d-learn
Hi, I want to list all processes by scanning /proc/. The following code doesn't work [code] foreach (string fstatm; dirEntries("/proc/", "[0-9]*", SpanMode.shallow)) { writefln("pid %s", fstatm); } [/code] as it only list a few entries before exiting [code] pid /proc/9 pid