Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Michal Balda
Hi, your solution does not work because files in /proc are virtual and have no size (their size will be reported as 0). FileStream>>contents sends #size to determine the length and that will return 0 for all files in /proc. So the solution is to use something that does not use #size, like: (F

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Martin Bähr
Excerpts from Norbert Hartl's message of 2015-03-19 14:09:28 +0100: > That's my point. Or better I like to know how the plugin can distinguish > them. Usually there shouldn't be a difference. I know the /proc filesystem. > It is what unix is all about. Make every information available as file. You

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Norbert Hartl
> Am 19.03.2015 um 13:26 schrieb Esteban Lorenzano : > >> >> On 19 Mar 2015, at 13:08, Norbert Hartl > > wrote: >> >> >>> Am 19.03.2015 um 11:51 schrieb Esteban Lorenzano >> >: >>> >>> On 19 Mar 2015, at 11:35, Julien Delplanque >>>

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Esteban Lorenzano
> On 19 Mar 2015, at 13:26, Esteban Lorenzano wrote: > >> >> On 19 Mar 2015, at 13:08, Norbert Hartl > > wrote: >> >> >>> Am 19.03.2015 um 11:51 schrieb Esteban Lorenzano >> >: >>> >>> On 19 Mar 2015, at 11:35, Julien Delplanque >>

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Damien Pollet
/proc are entries in the filesystem, as such I don't see why the file plugin would fail to access them… unless you cannot use block devices and such like any other file? In Unix, everything is a file, except those that have to be special-cased apart? On 19 March 2015 at 13:08, Norbert Hartl wrot

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Esteban Lorenzano
> On 19 Mar 2015, at 13:08, Norbert Hartl wrote: > > >> Am 19.03.2015 um 11:51 schrieb Esteban Lorenzano : >> >> >>> On 19 Mar 2015, at 11:35, Julien Delplanque wrote: >>> >>> >>> On 19/03/15 11:10, Esteban Lorenzano wrote: '/proc/uptime' asFileReference readStreamDo: [ :stream | stre

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Norbert Hartl
> Am 19.03.2015 um 11:51 schrieb Esteban Lorenzano : > > >> On 19 Mar 2015, at 11:35, Julien Delplanque wrote: >> >> >> On 19/03/15 11:10, Esteban Lorenzano wrote: >>> '/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ]. >>> >>> is better way. >>> >>> but you will sti

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Julien Delplanque
On 19/03/15 11:51, Esteban Lorenzano wrote: >> On 19 Mar 2015, at 11:35, Julien Delplanque wrote: >> >> >> On 19/03/15 11:10, Esteban Lorenzano wrote: >>> '/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ]. >>> >>> is better way. >>> >>> but you will still get an empty st

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Esteban Lorenzano
> On 19 Mar 2015, at 11:35, Julien Delplanque wrote: > > > On 19/03/15 11:10, Esteban Lorenzano wrote: >> '/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ]. >> >> is better way. >> >> but you will still get an empty string because actually ‘/proc’ does not >> contain

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Julien Delplanque
On 19/03/15 11:10, Esteban Lorenzano wrote: > '/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ]. > > is better way. > > but you will still get an empty string because actually ‘/proc’ does not > contains real files… so the file plugin does not applies there (and is > ano

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Esteban Lorenzano
'/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ]. is better way. but you will still get an empty string because actually ‘/proc’ does not contains real files… so the file plugin does not applies there (and is another debate if it should…) you should use OSProcess inst

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Nicolai Hess
2015-03-19 10:27 GMT+01:00 Julien Delplanque : > > > And, if there is a system library that provides this data, there is the > > NativeBoost way: > > For example( not linux but windows): > > > > new method: > > NBWin32Shell>>#getUptime > > > > > errorCode > > > ^ self nbCall: #( ulonglon

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Julien Delplanque
> And, if there is a system library that provides this data, there is the > NativeBoost way: > For example( not linux but windows): > > new method: > NBWin32Shell>>#getUptime > > errorCode > > ^ self nbCall: #( ulonglong GetTickCount64() ) module: #Kernel32 > > and then you can call it l

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Julien Delplanque
> (FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: > [:s | s upToEnd asString ] > > or if you load the "OSUnix" project in Pharo 4 from the config browser > it is even easier: > > UnixSystem upTime > > bye > T. > Thank you, that's exactly what I was looking for, I'll

Re: [Pharo-users] Get OS uptime

2015-03-19 Thread Nicolai Hess
2015-03-19 9:05 GMT+01:00 Torsten Bergmann : > Julien Delplanque wrote: > >I can't find out how to get the uptime of the OS from pharo > > (FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: > [:s | s upToEnd asString ] > > or if you load the "OSUnix" project in Pharo 4 from

[Pharo-users] Get OS uptime

2015-03-19 Thread Torsten Bergmann
Julien Delplanque wrote: >I can't find out how to get the uptime of the OS from pharo (FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: [:s | s upToEnd asString ] or if you load the "OSUnix" project in Pharo 4 from the config browser it is even easier: UnixSystem up

[Pharo-users] Get OS uptime

2015-03-18 Thread Julien Delplanque
Hi everyone, I can't find out how to get the uptime of the OS from pharo. I tried: (FileLocator root / 'proc' / 'uptime') readStream contents. and (FileSystem disk root / 'proc' / 'uptime') readStream contents. but all what I get is an empty string ''. I don't know if there are messages in s