The basics of interacting with Unix
Jump to navigation
Jump to search
- You absolutely need the package
OSProcess
- To get a reference to the process which is running your Cuis image do:
UnixProcess thisOSProcess . "=> a UnixProcess with pid 14751 "
- Then watch these interactions it should be all clear to you
". get the current working directory of the shell when it run Cuis "
UnixProcess thisOSProcess getCwd. "=> '/home/p/prog/cuis-project' "
". get the pid of the Cuis process and his father pid "
UnixProcess thisOSProcess pid. "=> 14751 "
UnixProcess thisOSProcess ppid. "=> 14750 "
" ------------
from here on there are class method shortcuts that let you type less but the idea is alwys the same you are asking 'UnixProcess thisOSProcess' to give you info.
------------ "
". get the environment variables of the shell who run Cuis "
UnixProcess env. "=> a Dictionary(#CLUTTER_IM_MODULE->'ibus' #COLORFGBG->'0;15' #COLORTERM->'truecolor' #DBUS_SESSION_BUS_ADDRESS->'unix:path=/run/user/1000/bus' .... #DESKTOP_SESSION->'plasma' #DISPLAY->':0.0' ) "
". the program name corresponding to Cuis, which is the name of the OpenSmalltalkVM"
UnixProcess programName . "=> './sqcogspur64linuxht/lib/squeak/5.0-202003021730/squeak' "
" . the VM arguments, where there is Cuis image file and some extra parameters "
UnixProcess arguments . "=> #('Cuis-Smalltalk-Dev/Cuis5.0-4975.image' '-d' 'Preferences veryBigFonts.') "
". get stdin, stdout, stderr "
". observe that by default, as of now, stdout and stderr are both copied to Transcript but only stderr will go printed into the shell which runs Cuis. "
UnixProcess stdOut nextPutAll: 'Hello world ! '.
UnixProcess stdErr nextPutAll: 'Hello world ! '.