holzschu / holzschu/a-shell

`command | rg | rg` doesn't work correctly

Open
#1,018 7 comments 0 reactions 0 assignees View on GitHub
fix committed
Dominant language
Perl
Stars
3.9k
Forks
213
Avg merge
1m
Merged PRs (30d)
1

Description

## Summary

`command | rg | rg` doesn't work correctly. The last pipe isn't working, and it looks like the two `rg` commands are in a race condition.

The workaround is to use `grep` instead of `rg`.

## Environment

- a-Shell 2.0.1 (549)
- iPadOS 26.5 RC
- [dotfiles](https://github.com/kkebo/dotfiles)

## Prerequisites

- `pkg install rg`
- `SHA256 (bin/rg.wasm3) = bd3d27817f2f34d625a3d24029eb2d5b16746ee4bb097d01eed8c99be9b83263`

## Steps to reproduce

1. Run `ls $APPDIR | rg lproj | rg e` on a-Shell
- `ls $APPDIR` is just an example. Any command can reproduce.

## Expected behavior

```console
$ ls $APPDIR | rg lproj | rg e
Base.lproj
de.lproj
es.lproj
$ ls $APPDIR | rg lproj
Base.lproj
de.lproj
es.lproj
fr.lproj
ja.lproj
ko.lproj
zh-Hans.lproj
```

## Actual behavior

```console
$ ls $APPDIR | rg lproj | rg e # pattern 1 (random)
Base.lproj
de.lproj
es.lproj
fr.lproj
ja.lproj
ko.lproj
zh-Hans.lproj
$ ls $APPDIR | rg lproj | rg e # pattern 2 (random)
Assets.car
Base.lproj
Frameworks
ImageMagick-7
Perl
Settings.bundle
SwiftTerm_SwiftTerm.bundle
_CodeSignature
a-Shell
cacert.pem
de.lproj
defaultToolbar.txt
defaultToolbar_iPad.txt
es.lproj
localCertificate.pem
localCertificate.pfx
localCertificateKey.pem
luatexCommandsDictionary.plist
node_modules
require.js
require_jscore.js
swift-nio-ssl_NIOSSL.bundle
swift-nio_NIOPosix.bundle
terminfo
texCommandsDictionary.plist
texmf.cnf
wasm_withWorker.js
wasm_worker_wasm.js
$ ls $APPDIR | rg lproj
Base.lproj
de.lproj
es.lproj
fr.lproj
ja.lproj
ko.lproj
zh-Hans.lproj
```

By the way, the built-in `grep` works correctly.

```console
$ unalias grep # because my .profile has `alias grep="rg"`
$ ls $APPDIR | grep lproj | grep e
Base.lproj
de.lproj
es.lproj
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.