[Newbies] Continue/Ignore error

gettimothy gettimothy at zoho.com
Thu Aug 29 21:57:18 UTC 2019


Hi folks.



The following code is working very well, but when an Error occurs, I would like it to ignore the error and continue.



Transcript clear.

[(WikitextModule allSubclasses select:[:module  |  (module pagetitle indexOf:$/ ifAbsent:[0]) > 0])

do:[:m | |ss f d cmd shell content  ios|

ss := m pagetitle squeakToUtf8 findBetweenSubStrs: '/'.

d := ss collect:[:each | each] from: 1 to: (ss size -1).

"handle Sandbox and User: here"

((d at:1) = 'Sandbox') | ((d at:1) beginsWith:'User:')

ifTrue:[]

ifFalse:[

d := d inject:'' into:[:a :b | a, '/',  b].

f := ('lua',d, '/', ss last, '.lua') squeakToUtf8  .    "ios writes to shared by default"

cmd := 'mkdir -p shared/lua', d.   "commandshell writes to squeak root directory, so we prepende 'shared' to it"

Transcript show: (m name), ' : ', cmd; cr.

shell := PipeableOSProcess bash. 

shell pipeFromOutput reader setNonBlocking. 

shell exec: cmd.

(Delay forMilliseconds: 400) wait. 

Transcript show: shell upToEnd ; cr.

shell close. 

content := m lua squeakToUtf8.

ios := FileStream newFileNamed: f.

ios isNil

ifFalse:[

content storeOn: ios.

ios close.

]].

]] ifError:[:x :y | Transcript show: x;cr. y close. thisContext resume]





The error is 

WikitextModule613405370 : mkdir -p shared/lua/Road_data/strings/USA/KY



Error: cannot create OS pipe





I am assuming it is happening during the mkdir -p command during the shell sequence of code in bold above but that is not my question.

Although it could be happening in the ios portion. 


My question is how, after the Error is thrown do I continue the 'do:[:m...] block?



thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190829/14deb452/attachment.html>


More information about the Beginners mailing list