"Launch" bug ?
[1/5] from: athymik::ifrance::com at: 24-Nov-2002 17:28
Hello everybody,
Here is my (long) problem :
When I try to use "reboot" function in my scripts, I get this error :
** Script Error: launch has no refinement called quit
** Where: reboot
** Near: launch/quit ""
>>
I found it a bit surprising... and when I try to get some help with "help
launch" I get :
8<----------------------------------------------------
USAGE:
LAUNCH arg /secure-cmd
DESCRIPTION:
(undocumented)
ARGUMENTS:
arg -- (Type: any)
REFINEMENTS:
/secure-cmd
8<----------------------------------------------------
Now, I was *very* surprised to see a system function, "reboot", trying to use
a refinement that doesn't exist, and I first thought it was a bug.
But I restarted rebol, and I tried to get some more help at the command line :
8<----------------------------------------------------
>> help launch
USAGE:
LAUNCH value /reboot /uninstall /link url /quit /secure-cmd
DESCRIPTION:
Launches a new REBOL interpreter process.
LAUNCH is a native value.
ARGUMENTS:
value -- The command-line arguments (Type: any-string)
REFINEMENTS:
/reboot
/uninstall
/link
url -- (Type: any)
/quit
/secure-cmd
8<----------------------------------------------------
I think Rebol overwrites the launch function before executing a script.
So I "traced it" (i'm sorry, english is not my mother tongue and i don't know
the good word) with "rebol -t" :
8<----------------------------------------------------
Trace: if (word)
Trace: system/options/script (path)
Trace: [
unprotect 'launch
launch: func [arg /secure-cmd] [alert "Launch can only be used by
launcher programs."]
if all [link? system/options/link-url] [connect-to-link]
if do-boot system/options/script system/script/args none [
if all [link? system/options/link-url] [
link-init-done
forever [
wait none
link-sweep-app
]
]
quit
]
either view? [
alert reform ["Cannot run script:" system/options/script]
quit
] [
print [system/options/script "could not be evaluated."]
]
] (block)
Trace: unprotect (word)
Trace: 'launch (lit-word)
Result: (unset)
Trace: launch: (set-word)
Trace: func (word)
Trace: [arg /secure-cmd] (block)
Trace: [alert "Launch can only be used by launcher programs."] (block)
8<----------------------------------------------------
Hmm... Why does Rebol overwrite this function ?
Thanks a lot,
Regards,
Athymik.
_____________________________________________
A few weeks ago, I discovered Rebol,
A few weeks ago, I discovered a wonder.
[2/5] from: greggirwin:mindspring at: 24-Nov-2002 11:39
Hi Athymik,
A> Hmm... Why does Rebol overwrite this function ?
LAUNCH is only really meant for use in the console. This comes up
quite a bit as it seems like it could be so handy, but it's RT's call
about what features they want to include.
-- Gregg
[3/5] from: athymik:ifrance at: 25-Nov-2002 16:27
> Hi Athymik,
>
> A> Hmm... Why does Rebol overwrite this function ?
>
> LAUNCH is only really meant for use in the console. This comes up
> quite a bit as it seems like it could be so handy, but it's RT's call
> about what features they want to include.
Thank you very much, Gregg.
I found an interesting "feature" in launch : it allows Rebol/Core to launch
an external program, for example :
>> a: system/options/boot
>> rename system/options/boot %tmp
>> copy %my_program a
>> launch "my-args"
>> delete %my_program
>> rename %tmp a
Can overwriting LAUNCH be a protection ?
> -- Gregg
Athymik
[4/5] from: greggirwin:mindspring at: 25-Nov-2002 11:00
<< Can overwriting LAUNCH be a protection ? >>
Yes. They do that with a number of things, mostly internal. LAUNCH is
handy in the console. If you need that functionality in regular
scripts, though, you need to buy View/Pro or /Command.
-- Gregg
[5/5] from: athymik:ifrance at: 25-Nov-2002 21:32
> << Can overwriting LAUNCH be a protection ? >>
>
> Yes. They do that with a number of things, mostly internal. LAUNCH is
> handy in the console. If you need that functionality in regular
> scripts, though, you need to buy View/Pro or /Command.
Nobody can impose buying View/Pro on everyone using its scripts !
Launching an external program is an essential functionality.
I've never seen another language which doesn't allow it.
But I may buy View/Pro for my personal usage...
> -- Gregg
Athymik