Skip to content

Commit

Permalink
[BUG] Add cmdargs parameter to work around issue with CEF under MacOS
Browse files Browse the repository at this point in the history
A new cmdargs configuration setting allows the addition of any command line
arguments to the launched processes. It defaults to  ENABLE_CEF=0 because
1) it makes the isolate processes a bit more lightweight and 2) it works
around an issue where runtime interpreters fail to start if CEF is enabled.

Closes issue #21
  • Loading branch information
mkromberg committed May 22, 2023
1 parent b57303a commit 252a7d9
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 71 deletions.
77 changes: 39 additions & 38 deletions Source/ynys/InitProcesses.dyalog
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
rss InitProcesses op;z;count;limit;ok;maxws;ws;rt;iso;ports;pids;pclts;procs;m;wd;of;ri
(count limit)0 3
maxws' MAXWS=',op.maxws
wsop.workspace
(ri of wd)op.(rideinit outfile workdir)
:If (rtop.runtime)0 1 if rt is boolean
rtrtop.onerror'debug' force runtime←0 if onerror≡'debug'
:EndIf
iso('isolate=isolate onerror=',(op.onerror),' isoid=',(ss.callback),maxws)
iso,' protocol=',op.protocol,' quiet=1'
:If ws.' ' ws1'""',checkWs addWSpath ws :EndIf if no path ('\/')
portsss.homeport+1+op.(processors×processes)

:Repeat
:If 0mcheckPortIsFree¨ports
'*** Warning - isolate port(s) in use: ',(~m)/ports
portsports+1+ports
:EndIf
:Until (/m)(ports)>1+op.homeportmax
'ISOLATE: Unable to find free ports'⎕SIGNAL(/m)11

pids(1⎕AI)+ports

:Repeat
count+1
procs{⎕NEW ##.APLProcess(ws rt ri of wd)}{'AutoShut=1 Port=',(),' APLCORENAME=',(),' ',iso}¨ports
procs.onExit{'{}#.DRC.Close ''PROC',,''''}¨¨pids signal soft shutdown to process

pcltspids InitConnections ss.orig ports ss.callback ss.remoteclients

:If ~ok~/0¨pclts at least one failed
'ISOLATE: Unable to connect to started processes (attempt ',(count),' of ',(limit),')'
⎕DL 5 {}procs.Kill ⎕DL 5
ports+1+op.(processors×processes)
:EndIf
:Until okcountlimit
'ISOLATE: Unable to initialise isolate processes'⎕SIGNAL ok11
rpids,procs,(ss.orig),ports,pclts
rss InitProcesses op;z;count;limit;ok;maxws;ws;rt;iso;ports;pids;pclts;procs;m;wd;of;ri
(count limit)0 3
maxws' MAXWS=',op.maxws
wsop.workspace
(ri of wd)op.(rideinit outfile workdir)
:If (rtop.runtime)0 1 if rt is boolean
rtrtop.onerror'debug' force runtime←0 if onerror≡'debug'
:EndIf
iso('isolate=isolate onerror=',(op.onerror),' isoid=',(ss.callback),maxws)
iso,' protocol=',op.protocol,' quiet=1'
iso,' ',op.cmdargs
:If ws.' ' ws1'""',checkWs addWSpath ws :EndIf if no path ('\/')
portsss.homeport+1+op.(processors×processes)

:Repeat
:If 0mcheckPortIsFree¨ports
'*** Warning - isolate port(s) in use: ',(~m)/ports
portsports+1+ports
:EndIf
:Until (/m)(ports)>1+op.homeportmax
'ISOLATE: Unable to find free ports'⎕SIGNAL(/m)11

pids(1⎕AI)+ports

:Repeat
count+1
procs{⎕NEW ##.APLProcess(ws rt ri of wd)}{'AutoShut=1 Port=',(),' APLCORENAME=',(),' ',iso}¨ports
procs.onExit{'{}#.DRC.Close ''PROC',,''''}¨¨pids signal soft shutdown to process

pcltspids InitConnections ss.orig ports ss.callback ss.remoteclients

:If ~ok~/0¨pclts at least one failed
'ISOLATE: Unable to connect to started processes (attempt ',(count),' of ',(limit),')'
⎕DL 5 {}procs.Kill ⎕DL 5
ports+1+op.(processors×processes)
:EndIf
:Until okcountlimit
'ISOLATE: Unable to initialise isolate processes'⎕SIGNAL ok11
rpids,procs,(ss.orig),ports,pclts
67 changes: 34 additions & 33 deletions Source/ynys/setDefaults.dyalog
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
setDefaults{
here⎕THIS
new0=here.⎕NC'options' set defaults only once
z{
spaceshere.(types options domains)here.⎕NS¨
tod{(2),1} type: Str Bool Int Ref
ensure all param names are minuscule as arg to Config is converted thus.
spaces.param← tod 'S' 'Default' 'and' 'the' 'Rest'
spaces.debugtod'B' 0 cut back on error
spaces.drctod'R'# copy into # if # and missing
spaces.listentod'B' 0 can isolate call back to ws
spaces.onerrortod'S' 'signal' 'debug' 'return'
spaces.processorstod'I'(processors ) no. processors (fn ignores ⍵)
spaces.processestod'I' 1 per processor
spaces.isolatestod'I' 99 per process
spaces.homeporttod'I' 7051 first port to attempt to use
spaces.homeportmaxtod'I' 7151 highest port allowed
spaces.runtimetod'A' 1 use runtime version
spaces.protocoltod'S' 'IPv4' 'IPv6' 'IP' default to IPv4
spaces.maxwstod'S'(##.RPCServer.GetEnv'MAXWS')
spaces.statustod'S' 'client' 'server' set as 'server' by StartServer
spaces.workspacetod'S'(getDefaultWS'isolate.dws') load current ws for remotes?
spaces.rideinittod'S' '' RIDE_INIT for APLProcess
spaces.outfiletod'S' '' log file prefix for APLProcess
spaces.workdirtod'S' '' working directory for APLProcess
1:1
}new0
0::(⎕DMX.DM)⎕SIGNAL ⎕DMX.EN
getSet this where Config called prior Init
called by Config before Init runs and by Init when it does.
set default options and permit user changes
but leave Init to apply them.
}
setDefaults{
here⎕THIS
new0=here.⎕NC'options' set defaults only once
z{
spaceshere.(types options domains)here.⎕NS¨
tod{(2),1} type: Str Bool Int Ref
ensure all param names are minuscule as arg to Config is converted thus.
spaces.param← tod 'S' 'Default' 'and' 'the' 'Rest'
spaces.debugtod'B' 0 cut back on error
spaces.drctod'R'# copy into # if # and missing
spaces.listentod'B' 0 can isolate call back to ws
spaces.onerrortod'S' 'signal' 'debug' 'return'
spaces.processorstod'I'(processors ) no. processors (fn ignores ⍵)
spaces.processestod'I' 1 per processor
spaces.isolatestod'I' 99 per process
spaces.homeporttod'I' 7051 first port to attempt to use
spaces.homeportmaxtod'I' 7151 highest port allowed
spaces.runtimetod'A' 1 use runtime version
spaces.protocoltod'S' 'IPv4' 'IPv6' 'IP' default to IPv4
spaces.maxwstod'S'(##.RPCServer.GetEnv'MAXWS')
spaces.statustod'S' 'client' 'server' set as 'server' by StartServer
spaces.workspacetod'S'(getDefaultWS'isolate.dws') load current ws for remotes?
spaces.rideinittod'S' '' RIDE_INIT for APLProcess
spaces.outfiletod'S' '' log file prefix for APLProcess
spaces.workdirtod'S' '' working directory for APLProcess
spaces.cmdargstod'S' 'ENABLE_CEF=0' add to command line
1:1
}new0
0::(⎕DMX.DM)⎕SIGNAL ⎕DMX.EN
getSet this where Config called prior Init
called by Config before Init runs and by Init when it does.
set default options and permit user changes
but leave Init to apply them.
}

0 comments on commit 252a7d9

Please sign in to comment.