Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat,fix: respect EXTISM_ENABLE_WASI_OUTPUT #45

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

chrisdickinson
Copy link
Contributor

I implemented this as an ExtismPluginOption, enableWasiOutput, that defaults to checking the environment variable (on platforms that support runtime environment variables.)

  • There was a WASI browser polyfill bug with the wasistdout module. Since wasistdout doesn't export a initialize or start method, we weren't initializing the context appropriately. This now fixed.
  • Neither Deno nor Node squelched WASI output before this commit. Now they do by default -- by opening /dev/null (or NUL on Windows) and sending that FD in instead.
  • And now the browser supports WASI output as well!

Fixes #43.

src/interfaces.ts Outdated Show resolved Hide resolved
Copy link
Member

@nilslice nilslice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I implemented this as an `ExtismPluginOption`, `enableWasiOutput`, that
defaults to checking the environment variable (on platforms that support
runtime environment variables.)

- There was a WASI browser polyfill bug with the wasistdout module.
  Since `wasistdout` doesn't export a `initialize` or `start` method,
  we weren't initializing the context appropriately. This now fixed.
- Neither Deno nor Node squelched WASI output before this commit. Now
  they do by default -- by opening /dev/null (or NUL on Windows) and
  sending that FD in instead.
- And now the browser supports WASI output as well!
- Additionally, simplify all `prop?: T | undefined` to `prop?: T` in
  `src/interfaces.ts`.

Fixes #43.
@chrisdickinson chrisdickinson force-pushed the chris/20240104-respect-extism-output-env-var branch from 8036bc8 to 3d4164c Compare January 5, 2024 18:32
@chrisdickinson chrisdickinson merged commit 85b5022 into main Jan 5, 2024
3 checks passed
@chrisdickinson chrisdickinson deleted the chris/20240104-respect-extism-output-env-var branch January 5, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for enabling WASI output via EXTISM_ENABLE_WASI_OUTPUT env var
2 participants