[Pharo-users] Re: "Print it" redirection

2024-02-21 Thread Richard O'Keefe
What stops you copy and paste?

Using ANSI Smalltalk, you'd do
   [:stream | stream print: 1000 factorial; cr; close] value:
(FileStream write: 'factorial.txt'.
Pharo has never provided an ANSI-compatible FileStream class, which is
a pain for
trying to write portable code.  In Pharo you have to write
  'factorial.txt' asFileReference writeStreamDo: [:stream | stream
print: 1000 factorial; cr].


In Pharo 9, you'd have to change #write: to #newFileNamed:.
I wanted to check this in Pharo 12, but PharoLauncher has stopped working.

On Tue, 20 Feb 2024 at 20:46, Rene Paul Mages (ramix)  wrote:
>
> Hello Pharo Community,
>
> Output unix-redirection like the following is very useful :
>
> ls -al ./Pharo > Pharo-dir.txt
>
> 
>
> I want to write in a file the "print-it" output of the following Pharo
> message :
>
>  1000 factorial
>
> Please give me a good track.
>
> 
>
>
> --
> All the best
> Rene Paul Mages (ramix) GnuPG key : 0x9840A6F7
> http://sites.google.com/view/les-logiciels-libres/pharo
> http://nosoftwarepatents.wikidot.com/smalltalk
> http://twitter.com/RenePaulMages


[Pharo-users] Re: "Print it" redirection

2024-02-20 Thread Tim Mackinnon
Hi - the following is a bit old but might still work (and I plan on revisiting 
it myself) - but my poor man's Pharo build system does the following (note the 
| tee which I use to capture any load errors that I can grep and cause a build 
failure). This might be the kind of thing you are looking for - or as others 
have said you can run headless.

echo -e "\e[1m\nLoading project packages...\e[0m"
pharo Pharo.image --no-default-preferences --save --quit st settings.st 
loadProject.st config.st \
"{'$PROJECT_NAME'. '$DOMAIN_LOGIN'}" 2>&1 | tee LoadProject.log

echo -e "\e[1m\nVerifying project load history...\e[0m"
if (grep -f ../scripts/errorPatterns.txt LoadProject.log | grep -v -f 
../scripts/errorPatternsIgnored.txt); then
echo -e "\e[91m\nERRORS detected in package load!\e[0m";
exit 1;
fi

On Tue, 20 Feb 2024, at 7:46 AM, Rene Paul Mages (ramix) wrote:
> Hello Pharo Community,
>
> Output unix-redirection like the following is very useful :
>
> ls -al ./Pharo > Pharo-dir.txt
>
> 
>
> I want to write in a file the "print-it" output of the following Pharo 
> message :
>
>  1000 factorial
>
> Please give me a good track.
>
> 
>
>
> -- 
> All the best
> Rene Paul Mages (ramix) GnuPG key : 0x9840A6F7
> http://sites.google.com/view/les-logiciels-libres/pharo
> http://nosoftwarepatents.wikidot.com/smalltalk
> http://twitter.com/RenePaulMages


[Pharo-users] Re: "Print it" redirection

2024-02-20 Thread Koen De Hondt
Rene Paul,

Try this. Example command line from MacOS.

~/Pharo/vms/120-x64/Pharo.app/Contents/MacOS/Pharo --headless 
pharo12.image eval 1000 factorial

Replace ~/Pharo/vms/120-x64/Pharo.app/Contents/MacOS/Pharo by the path to the 
VM you like to use.
Replace pharo12.image by the path to the image you like to use.

It will output:

4023872600770937735437024339230039857193748642107146325437999104299385123986290205920442084869694048004799886101971960586316668729948085589013238296699445909974245040870737599188236277271887325197795059509952761208749754624970436014182780946464962910563938874378864873371191810458257836478499770124766328898359557354325131853239584630755574091142624174743493475534286465766116677973966688202912073791438537195882498081268678383745597317461360853795345242215865932019280908782973084313928444032812315586110369768013573042161687476096758713483120254785893207671691324484262361314125087802080002616831510273418279777047846358681701643650241536913982812648102130927612448963599287051149649754199093422215668325720808213331861168115536158365469840467089756029009505376164758477284218896796462449451607653534081989013854424879849599533191017233660213945039973628075013783761530712776192684903435262520001588853514733161170210396817592151090778801939317811419454525722386554146106289218796022383897147608850627686296714667469756291123408243920816015378088989396451826324367161676217916890977991190375403127462228998800519514282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490217659043399018860185665264850617997023561938970178600408118897299183110211712298459016419210688843871218556461249607987229085192968193723886426148396573822911231250241866493531439701374285319266498753372189406942814341185201580141233448280150513996942901534830776445690990731524332782882698646027898643211390835062170950025973898635542771967428222487575867657523442202075736305694988250879689281627538488633969099598262809561214509948717012445164612603790293091208890869420285106401821543994571568059418727489980942547421735824010636774045957417851608292301353580818400969963725242305608559037006242712434169090041536901059339838357779394109700277534720

Ciao,
Koen

> On 20 Feb 2024, at 08:46, Rene Paul Mages (ramix)  wrote:
> 
> Hello Pharo Community,
> 
> Output unix-redirection like the following is very useful :
> 
> ls -al ./Pharo > Pharo-dir.txt
> 
> 
> 
> I want to write in a file the "print-it" output of the following Pharo 
> message :
> 
>1000 factorial
> 
> Please give me a good track.
> 
> 
> 
> 
> -- 
> All the best
> Rene Paul Mages (ramix) GnuPG key : 0x9840A6F7
> http://sites.google.com/view/les-logiciels-libres/pharo
> http://nosoftwarepatents.wikidot.com/smalltalk
> http://twitter.com/RenePaulMages