private static async Task <string> executeJS(string js) { var(exitcode, stdout, stderr, debugOutput) = await ProcessExtensions.ExecuteJS(js); Console.WriteLine(stderr); Console.WriteLine(debugOutput); return(stdout); }
private static async Task <string> executeJS(object arg, JsonSerializerOptions?options = null) { var(exitcode, stdout, stderr, debugOutput) = await ProcessExtensions.ExecuteJS(NO_IMPORTS, arg, options : options); Console.WriteLine(stderr); Console.WriteLine(debugOutput); return(stdout); }
public async Task ExecutingJSViaTempFileOrBashIsIdentical() { foreach (string s in new[] { "\\\\sqrt{}", // literal js: console.log("\\sqrt{}") "\\\\b", // literal js: console.log("\\b") "\\\"", // literal js: console.log("\"") "\\\"\\\"", // literal js: console.log("\"\"") "\\t", // literal js: console.log("\t") "\t", // literal js: console.log(" ") "\\n" }) // literal js: console.log("\n") { string js = $"console.log(\"{s}\")"; var(_, stdOutViaFile, fileErr, _) = await ProcessExtensions.ExecuteJSViaTempFile(js); var(_, stdOutViaBash, bashErr, _) = await ProcessExtensions.ExecuteJS(js); Assert(fileErr == ""); Assert(bashErr == ""); Assert(stdOutViaFile == stdOutViaBash); } }