package runtimeconfig

import (
	"context"
	"os/exec"
)

// RuntimeCommandContext constructs a runtime command and applies any
// platform-specific command-line encoding required by its launcher shim.
func RuntimeCommandContext(ctx context.Context, t RuntimeType, binary string, args []string) *exec.Cmd {
	command, commandArgs := RuntimeCommand(t, binary, args)
	cmd := exec.CommandContext(ctx, command, commandArgs...)
	configureRuntimeCommandLine(cmd, t, command, commandArgs)
	return cmd
}
