Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Feedback.
  • Loading branch information
maraf authored and github-actions committed Sep 29, 2022
commit c674716f9dc94f2077bc616c82e5dbc68f1bdb11
7 changes: 2 additions & 5 deletions src/mono/wasm/templates/templates/console/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

import { dotnet } from './dotnet.js'

const is_node = typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string';
if (!is_node) throw new Error(`This file only supports nodejs`);

const { setModuleImports, getAssemblyExports, getConfig, runMainAndExit } = await dotnet
const { setModuleImports, getAssemblyExports, getConfig } = await dotnet
.withDiagnosticTracing(false)
.create();

Expand All @@ -23,4 +20,4 @@ const exports = await getAssemblyExports(config.mainAssemblyName);
const text = exports.MyClass.Greeting();
console.log(text);

await runMainAndExit(config.mainAssemblyName, ['dotnet', 'is', 'great!']);
await dotnet.run();
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ private void UpdateConsoleMainJs()
string mainJsContent = File.ReadAllText(mainJsPath);

mainJsContent = mainJsContent
.Replace(".create()", ".withConsoleForwarding().create()")
.Replace("['dotnet', 'is', 'great!']", "(await import('process')).argv.slice(2)");
.Replace(".create()", ".withConsoleForwarding().create()");

File.WriteAllText(mainJsPath, mainJsContent);
}
Expand Down