Tag: ASYNC-AWAIT
Ejemplo ilustrando mi proyecto. static async Task Main() { await RunAsync(“a.exe”, string.Empty, string.Empty, 100000, null); } static async Task RunAsync(string fileName, string arguments, string workingDir, int timeLimit, string input) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = fileName.ToString(); startInfo.Arguments = arguments.ToString(); startInfo.WorkingDirectory = workingDir; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; . . . Read more
Cuando ejecuto esta función, obtengo el resultado esperado a través de console.log, pero la función no se cierra. ¿Por qué es así? const puppeteer = require(‘puppeteer’); async function scrape(url) { const browser = await puppeteer.launch(); const page = await browser.newPage(); const target = await page.goto(url); const waiting = await page.waitForXPath(‘XPATH…’); . . . Read more
Era mi entendimiento que una función asíncrona es, bueno, asíncrona. Entonces no espera, por lo que el llamador no espera a que se complete, simplemente devuelve inmediatamente una promesa que se resolverá en un momento posterior, a menos que se utilice la palabra clave “await”. Estoy ejecutando este código en . . . Read more
getInitialTripData llama a getCurrentLocationData con await pero nunca imprime “coming here 1” y en getCurrentLocationData la función continúa hasta imprimir los datos y luego se bloquea en la declaración de retorno, no sé cuál es el problema. “` setInitialTripData() async { print("coming here"); MapLocation startingPoint = await Get.find<locationservice>().getCurrentLocationData(); print("coming here . . . Read more
De los ejemplos a continuación, no entiendo por qué el código async y await no funcionan en el primer ejemplo pero sí funcionan en el segundo ejemplo. 1er Ejemplo: public static async Task Main(string[] args) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Console.WriteLine(“comenzó”); var i = await GetIntAsync(10); var j . . . Read more