I've been working on some changes for runwasi and I've noticed that modules get passed the program name in the wasmtime cli as the first argument. In my PR to runwasi, I found that I didn't need to pass the module name and everything worked properly. It feels strange to me to have applications that skip the first argument to do work.
What is the reason for the first argument being the module name? Is the approach I took valid?
This matches unix and windows where thw first arg is also what the user wrote as program to run. This for example allow customizing help messages based on the actual executable name or to have an executable which contains multiple programs and dispatches based on the name used to execute it. For example busybox is a single executable with all coreutils. If you create a symlink or hardlink from ls to the busybox executable, running ls will make busybox list all files in a directory, but if say the symlink or hardlink is called echo it would echo it's arguments back.
oh gosh, I feel like I should have known that :flushed: thank you (my c# background is showing up where args to the main entry point don't include the program name thought you can get it elsewhere)
Last updated: Dec 23 2024 at 12:05 UTC