Internal code to handle execution

Property definitions

core $ Process :: execute
	# Internal code to handle execution
	protected fun execute
	do
		var arguments = self.arguments

		var args = new FlatBuffer
		var argc = 1

		if not is_windows then
			# Pass the arguments as a big C string where elements are separated with '\0'
			args.append command
			if arguments != null then
				for a in arguments do
					args.add '\0'
					args.append a
				end
				argc += arguments.length
			end
		else
			# Combine the program and args in a single string
			assert not command.chars.has('"')
			args = new FlatBuffer

			args.add '"'
			args.append command
			args.add '"'

			if arguments != null then
				for a in arguments do
					args.append " \""
					args.append a.replace('"', "\\\"")
					args.add '"'
				end
			end
		end

		data = basic_exec_execute(command.to_cstring, args.to_s.to_cstring, argc, pipeflags)
		assert not data.address_is_null else print_error "Internal error executing: {command}"
	end
lib/core/exec.nit:101,2--139,4

core $ ProcessReader :: execute
	redef fun execute
	do
		super
		stream_in = new FileReader.from_fd(data.out_fd)
	end
lib/core/exec.nit:358,2--362,4

core $ ProcessWriter :: execute
	redef fun execute
	do
		super
		var out = new FileWriter.from_fd(data.in_fd)
		out.set_buffering_mode(0, sys.buffer_mode_none)
		stream_out = out
	end
lib/core/exec.nit:381,2--387,4

core $ ProcessDuplex :: execute
	redef fun execute do super
lib/core/exec.nit:404,2--27