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

Add support for WASI #7

Closed
wants to merge 1 commit into from
Closed

Add support for WASI #7

wants to merge 1 commit into from

Conversation

zebp
Copy link

@zebp zebp commented Mar 1, 2021

Adds support for the wasm32-wasi but currently requires nightly for wasi due to the requirement of the wasi_ext feature for std::os::wasi::fs::MetadataExt.

@niklasmohrin
Copy link
Owner

Hey, what exactly is the motivation behind this? I suspect that you are wanting to build bat for wasi, right? In that case, I have to be upfront and say that I cannot promise you checked support and you will have open an issue in that repository.

We can however gladly integrate support, under three conditions.

  1. nightly is only required when targetting wasi
  2. we can test wasi in ci
  3. we dont duplicate all of the code from unix but rather swap out the important parts in one place

The latter shouldn't be too bad. Since this new file is just a copy of the existing logic for the UnixIdentifier, this should rather add the specifics to this file and not have it duplicated.

It should be as easy as

#[cfg(not(target_os = "wasi"))]
use std::os::unix as os;
#[cfg(target_os = "wasi")]
use std::os::wasi as os;

use os::fs::MetaDataExt;
use os::io::{FromRawFd, IntoRawFd, RawFd};

and some cfg_attr to enable the feature if the target platform matches.

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.

None yet

2 participants