You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pluginlab@0.5.0 release introduces the plugin-tee plugin that allows the user to tee the output of the REPL to a file - it's the first plugin that does WRITE operations.
The plugin works well in the REPL cli, but it is not yet supported in the web host.
This issue tracks the work to add support for the plugin-tee plugin in the web host.
Changes to add plugin-tee to the web host
packages/web-host/src/utils/github.ts
cat: "https://github.com/topheman/webassembly-component-model-experiments/tree/master/crates/plugin-cat",
echoc:
"https://github.com/topheman/webassembly-component-model-experiments/blob/master/c_modules/plugin-echo/component.c",
+ tee: "https://github.com/topheman/webassembly-component-model-experiments/tree/master/crates/plugin-tee",
} as const;
> echo Some Content
Some Content
> tee some-new-file
Some Content
> cat some-new-file
Some Content
Bug
It's possible to tee over a file that was created with tee on the current session, however, it doesn't reset all the bytes:
> echo Some Content
Some Content
> tee some-new-file
Some Content
> cat some-new-file
Some Content
> echo foo
foo
> tee some-new-file
foo
> cat some-new-file
fooe Content
It works correctly when ran on the cli.
Error case
tee some-existing-file:
first run: Error: RangeError: offset is out of bounds
then: Error: RuntimeError: unreachable
tee -a some-existing-file:
first run: Error: TypeError: Resource error: Not a valid "OutputStream" resource.
Error: RuntimeError: unreachable
Todo
Fix: tee over a file created with tee on the current session
The
pluginlab@0.5.0release introduces theplugin-teeplugin that allows the user to tee the output of the REPL to a file - it's the first plugin that does WRITE operations.The plugin works well in the REPL cli, but it is not yet supported in the web host.
This issue tracks the work to add support for the
plugin-teeplugin in the web host.Changes to add
plugin-teeto the web hostpackages/web-host/src/utils/github.ts
cat: "https://github.com/topheman/webassembly-component-model-experiments/tree/master/crates/plugin-cat", echoc: "https://github.com/topheman/webassembly-component-model-experiments/blob/master/c_modules/plugin-echo/component.c", + tee: "https://github.com/topheman/webassembly-component-model-experiments/tree/master/crates/plugin-tee", } as const;packages/web-host/src/wasm/engine.ts
import("./generated/plugin_greet/transpiled/plugin_greet.js"), import("./generated/plugin_ls/transpiled/plugin_ls.js"), import("./generated/plugin_cat/transpiled/plugin_cat.js"), + import("./generated/plugin_tee/transpiled/plugin_tee.js"), import("./generated/plugin-echo-c/transpiled/plugin-echo-c.js"), ]).then((plugins) => plugins.map((plugin) => {Reproduce :
Working case
The
teecommand works when writing to a new file.Bug
It's possible to
teeover a file that was created with tee on the current session, however, it doesn't reset all the bytes:It works correctly when ran on the cli.
Error case
tee some-existing-file:Error: RangeError: offset is out of boundsError: RuntimeError: unreachabletee -a some-existing-file:Error: TypeError: Resource error: Not a valid "OutputStream" resource.Error: RuntimeError: unreachableTodo
teeover a file created withteeon the current sessionteeover a file that already existstee -aErrors