Skip to content

Fix @$() subprocess operator#3512

Merged
scopatz merged 4 commits into
xonsh:masterfrom
laloch:fix-captured-inject
Apr 8, 2020
Merged

Fix @$() subprocess operator#3512
scopatz merged 4 commits into
xonsh:masterfrom
laloch:fix-captured-inject

Conversation

@laloch

@laloch laloch commented Apr 8, 2020

Copy link
Copy Markdown
Member

See the trail in #3156, #3510.

Closes #2328
Closes #2755
Closes #3457

@laloch

laloch commented Apr 8, 2020

Copy link
Copy Markdown
Member Author

🎆

@scopatz scopatz merged commit d86cea1 into xonsh:master Apr 8, 2020
@laloch laloch deleted the fix-captured-inject branch April 8, 2020 17:07
@gforsyth

gforsyth commented Apr 8, 2020

Copy link
Copy Markdown
Collaborator

Whoop! Thanks for tracking this one down, @laloch! It was deeply satisfying to get all of those "issue closed" notifications just now.

anki-code added a commit that referenced this pull request Mar 5, 2026
…`$THREAD_SUBPROCS=False` (#6112)

### Motivation

1. `@$()` is using captured_object that is working in parallel thread
and sometimes can produce race condition. We need to replace it back to
captured_stdout. cc #3512
2. Because of `$()` is working in `$THREAD_SUBPROCS=False` so `@$()`
should work.

Closes #4056
cc #4094

### Before

```xsh
$THREAD_SUBPROCS=False
showcmd $(echo '1\n2 3')  # working
# ['1\n2 3\n']
showcmd @$(echo '1\n2 3')  # not working
# 1    # not captured
# 2 3  # not captured
# <showcmd help>
```

### After

```xsh
$THREAD_SUBPROCS=False
showcmd $(echo '1\n2 3')  # working
# ['1\n2 3\n']
showcmd @$(echo '1\n2 3')  # working
# ['1', '2', '3']
```


## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: Andy Kipp <123@321.123>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

Unexpected newlines in @$(...) substitution Captured subprocess syntax issue Syntax for *just* stripping last newline

3 participants