Skip to content

Commit

Permalink
[wasm] Misc improvements (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
radical authored Sep 17, 2022
1 parent b9ece2f commit a5369fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,23 @@ protected override async Task<ExitCode> InvokeInternal(ILogger logger)

options.AddArguments(new[]
{
// added based on https://github.com/puppeteer/puppeteer/blob/main/src/node/Launcher.ts#L159-L181
"--allow-insecure-localhost",
"--disable-breakpad",
"--disable-component-extensions-with-background-pages",
"--disable-dev-shm-usage",
"--disable-extensions",
"--disable-features=TranslateUI",
"--disable-ipc-flooding-protection",
"--force-color-profile=srgb",
"--metrics-recording-only"
});
// added based on https://github.com/puppeteer/puppeteer/blob/main/src/node/Launcher.ts#L159-L181
"--allow-insecure-localhost",
"--disable-breakpad",
"--disable-component-extensions-with-background-pages",
"--disable-dev-shm-usage",
"--disable-extensions",
"--disable-features=TranslateUI",
"--disable-ipc-flooding-protection",
"--force-color-profile=srgb",
"--metrics-recording-only"
});

if (File.Exists("/.dockerenv"))
{
// Use --no-sandbox for containers, and codespaces
options.AddArguments("--no-sandbox");
}

if (Arguments.NoQuit)
options.LeaveBrowserRunning = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public async Task RunAsync(CancellationToken token)
}
catch (Exception ex)
{
_channelWriter.TryComplete();
_channelWriter.TryComplete(ex);

// surface the exception from task for this method
// and from _completed
Expand Down Expand Up @@ -195,7 +195,8 @@ private void ProcessMessage(string message, bool isError = false)
if (line.StartsWith("WASM EXIT"))
{
_logger.LogDebug("Reached wasm exit");
WasmExitReceivedTcs.SetResult();
if (!WasmExitReceivedTcs.TrySetResult())
_logger.LogDebug("Got a duplicate exit message.");
}
}

Expand Down

0 comments on commit a5369fa

Please sign in to comment.