[REBOL] Found Bug. Was: Re: View event loop broken? Was: Re: [Fwd: Re: Rugby bu
From: nitsch-lists::netcologne::de at: 20-Jun-2003 15:13
Bug:
When using launch and then wait on a port, /views event-loop freezes
when launched script quits..
Because:
A terminating process sends a unix-signal,
and that interrupts wait.
The signal can be found in system/ports/system.
Also wait returns the first port in the block.
this block is marked as "has content",
which is cleared by 'pick or 'first.
A 'do-events / wait without ports is not interrupted.
Bug-Demo:
[REBOL [Title: "launch-wait-bug demo"]
save %test.r [rebol[] alert "test" quit]
launch %test.r
port: open/no-wait tcp://:8002
probe wait port
print "interrupted"
probe pick system/ports/system 1
;now this hangs
con: first port
print "got connection"
;will print
;interrupted
;[child 13026 0]
]
Workaround:
give a dummy-port port as first argument.
But pick on it blocks.
Trick: system/ports/system, the system-port, works.
like
data-on: wait [system/ports/system real-port]
if not same? data-on system/ports/system[
;we have data
]
;patched-wait:
;drops launchs signal.
;bug: also all others on system/ports/system
;does not support /all yet.
patched-wait: func[ports /local data-on][
forever[
data-on: wait head insert to-block ports system/ports/system
either same? data-on system/ports/system[
probe pick system/ports/system 1 ;clear event
][
return data-on
]
]
]
Tested on:
/view 1.2.10.4.2, suse 8.0
-Volker