summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2023-09-21 13:13:46 -0400
committerAndrew Gallant <jamslam@gmail.com>2023-09-25 14:39:54 -0400
commit25a7145c79492e8dc89b6ece9c5214c37d60d23d (patch)
treef60e7169da7ab9fa3051be11015601fbee5a548c /.github
parent19a08bee8a99e8c725b9781568013a9f686605a3 (diff)
cli: add new 'hostname' function
This will enable us to query for the current system's hostname in both Unix and Windows environments. We could have pulled in the 'gethostname' crate for this, but: 1. I'm not a huge fan of micro-crates. 2. The 'gethostname' crate panics if an error occurs. (Which, to be fair, an error should never occur, but it seems plausible on borked systems? ripgrep runs in a lot of places, so I'd rather not take the chance of a panic bringing down ripgrep for an optional convenience feature.) 3. The 'gethostname' crate uses the 'windows-targets' crate from Microsoft. This is arguably the "right" thing to do, but ripgrep doesn't use them yet and they appear high-churn. So I just added a safe wrapper to do this to winapi-util[1] and then inlined the Unix version here. This brings in no extra dependencies and the routine is fallible so that callers can recover from potentially strange failures. [1]: https://github.com/BurntSushi/winapi-util/pull/14
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml4
1 files changed, 4 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bf8c2004..a98a2f56 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -193,6 +193,10 @@ jobs:
shell: bash
run: ci/test-complete
+ - name: Print hostname detected by grep-cli crate
+ shell: bash
+ run: ${{ env.CARGO }} test --manifest-path crates/cli/Cargo.toml ${{ env.TARGET_FLAGS }} --lib print_hostname -- --nocapture
+
rustfmt:
runs-on: ubuntu-latest
steps: