let output_of_file_name file_name variables =
try
let source_command_line =
Printf.sprintf "set -e; (source %s 2> /dev/null &&" file_name in
let command_line =
List.fold_left
(fun string variable ->
Printf.sprintf "%s echo %s $%s && " string variable variable)
source_command_line
variables in
let command_line = command_line ^ " true) 2> /dev/null" in
let (output, exit_code) = Unix.run command_line in
if not (exit_code = Unix.WEXITED 0) then
failwith ("Failed when source'ing the configuration file " ^ file_name)
else begin
output;
end
with _ -> begin
"";
end