summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml15
-rw-r--r--crates/cli/src/hostname.rs4
-rw-r--r--crates/printer/src/hyperlink.rs7
3 files changed, 24 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d21b85ab..532e2e9c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -189,6 +189,21 @@ jobs:
shell: bash
run: ${{ env.CARGO }} test --bin rg ${{ env.TARGET_FLAGS }} flags::defs::tests::available_shorts -- --nocapture
+ # Setup and compile on the wasm32-wasi target
+ wasm:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@master
+ with:
+ toolchain: stable
+ - name: Add wasm32-wasi target
+ run: rustup target add wasm32-wasi
+ - name: Basic build
+ run: cargo build --verbose
+
rustfmt:
runs-on: ubuntu-latest
steps:
diff --git a/crates/cli/src/hostname.rs b/crates/cli/src/hostname.rs
index 37ad54c7..0a3ae370 100644
--- a/crates/cli/src/hostname.rs
+++ b/crates/cli/src/hostname.rs
@@ -25,10 +25,10 @@ pub fn hostname() -> io::Result<OsString> {
}
#[cfg(not(any(windows, unix)))]
{
- io::Error::new(
+ Err(io::Error::new(
io::ErrorKind::Other,
"hostname could not be found on unsupported platform",
- )
+ ))
}
}
diff --git a/crates/printer/src/hyperlink.rs b/crates/printer/src/hyperlink.rs
index 279258c1..ec1fd921 100644
--- a/crates/printer/src/hyperlink.rs
+++ b/crates/printer/src/hyperlink.rs
@@ -811,6 +811,13 @@ impl HyperlinkPath {
Some(HyperlinkPath::encode(with_slash.as_bytes()))
}
+ /// For other platforms (not windows, not unix), return None and log a debug message.
+ #[cfg(not(any(windows, unix)))]
+ pub(crate) fn from_path(original_path: &Path) -> Option<HyperlinkPath> {
+ log::debug!("hyperlinks are not supported on this platform");
+ None
+ }
+
/// Percent-encodes a path.
///
/// The alphanumeric ASCII characters and "-", ".", "_", "~" are unreserved