Fix LAUNCH to properly work with argv-based CALL
Fix LAUNCH to properly work with argv-based CALL

The more comprehensive implementation of CALL switched to a block-based
interface for passing multiple arguments. This broke LAUNCH, as LAUNCH
would simple concatenate interpreter and script into a single string and
pass that to CALL. This commit adapts LAUNCH to pass a block to CALL.

draegtun/ren-c,hostilefork/rebol,mbk/ren-c,hostilefork/rebol,hostilefork/rebol,hostilefork/rebol,mbk/ren-c,kealist/ren-c,kealist/ren-c,draegtun/ren-c,giuliolunati/ren-c,rgchris/ren-c,rgchris/ren-c,draegtun/ren-c,giuliolunati/ren-c,giuliolunati/ren-c,kealist/ren-c,codebybrett/ren-c,mbk/ren-c,giuliolunati/ren-c,kealist/ren-c,codebybrett/ren-c,rgchris/ren-c,draegtun/ren-c,rgchris/ren-c,giuliolunati/ren-c,mbk/ren-c,rgchris/ren-c,hostilefork/rebol,draegtun/ren-c,codebybrett/ren-c,codebybrett/ren-c,kealist/ren-c,codebybrett/ren-c
REBOL [
	System: "REBOL [R3] Language Interpreter and Run-time Environment"
	Title: "REBOL 3 Mezzanine: Control"
	Rights: {
		Copyright 2012 REBOL Technologies
		REBOL is a trademark of REBOL Technologies
	}
	License: {
		Licensed under the Apache License, Version 2.0
		See: http://www.apache.org/licenses/LICENSE-2.0
	}
]

launch: func [
	{Runs a script as a separate process; return immediately.}
	script [file! string! none!] "The name of the script"
	/args arg [string! block! none!] "Arguments to the script"
	/wait "Wait for the process to terminate"
][
	if file? script [script: to-local-file clean-path script]
	args: reduce [to-local-file system/options/boot script]
	if arg [append args arg]
	either wait [call/wait args] [call args]
]

wrap: func [
	"Evaluates a block, wrapping all set-words as locals."
	body [block!] "Block to evaluate"
][
	do bind/copy/set body make object! 0
]

REBOL [
	System: "REBOL [R3] Language Interpreter and Run-time Environment"
	Title: "REBOL 3 Mezzanine: Control"
	Rights: {
		Copyright 2012 REBOL Technologies
		REBOL is a trademark of REBOL Technologies
	}
	License: {
		Licensed under the Apache License, Version 2.0
		See: http://www.apache.org/licenses/LICENSE-2.0
	}
]

launch: func [
	{Runs a script as a separate process; return immediately.}
	script [file! string! none!] "The name of the script"
	/args arg [string! block! none!] "Arguments to the script"
	/wait "Wait for the process to terminate"
	/local exe
][
	if file? script [script: to-local-file clean-path script]
	exe: to-local-file system/options/boot

	; Quote everything, just in case it has spaces:
	args: to-string reduce [{"} exe {" "} script {" }]
	if arg [append args arg]
	either wait [call/wait args] [call args]
]

wrap: func [
	"Evaluates a block, wrapping all set-words as locals."
	body [block!] "Block to evaluate"
][
	do bind/copy/set body make object! 0
]
