Skip to content

Overriding argv[0] for wasmtime run #8955

@whitequark

Description

@whitequark

Feature

I would like it to be possible to override argv[0] for commands executed with wasmtime run. E.g.:

wasmtime run --argv0=clang++ bin/clang.wasm ...

Benefit

Certain applications use the value of argv[0] to:

  • Dispatch between incompatible code paths (multi-call binaries), e.g. Clang;
  • Discover location of data via executable-relative paths, e.g. also Clang in some cases (not the usual configuration though).

In general I think the path passed to wasmtime run is only meaningful on the host and will rarely if ever mean anything within the sandbox.

Implementation

A new option --argv0= would work for me, but really anything that gets the job done is fine.

Alternatives

I can't think of any besides not having the functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions