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

Redirection errors terminate the containing subshell (and shell) #341

Closed
ko1nksm opened this issue Jan 21, 2025 · 1 comment · Fixed by #375
Closed

Redirection errors terminate the containing subshell (and shell) #341

ko1nksm opened this issue Jan 21, 2025 · 1 comment · Fixed by #375
Assignees
Labels
bug Something isn't working

Comments

@ko1nksm
Copy link

ko1nksm commented Jan 21, 2025

$ touch /tmp/dummy

$ brush --version
brush 0.2.14 (git:dd1d39c)

$ brush -c 'set -C; (: > /tmp/dummy); echo reach here'
ERROR error: failed to redirect to /tmp/dummy: File exists (os error 17)

$ bash -c 'set -C; (: > /tmp/dummy); echo reach here'
bash: line 1: /tmp/dummy: cannot overwrite existing file
reach here
@reubeno
Copy link
Owner

reubeno commented Jan 22, 2025

This is a good find, thanks for the clear steps.

It looks like this more broadly applies to redirection errors, e.g.:

$ brush -c ': >/non/existent; echo hi'
ERROR error: failed to redirect to /non/existent: No such file or directory (os error 2)

$ bash -c ': >/non/existent; echo hi'
bash: line 1: /non/existent: No such file or directory
hi

We will need to ensure these errors are recoverable, and will neither cause the subshell nor the shell to exit.

@reubeno reubeno changed the title When using set -C, errors in the subshell will terminate the shell Redirection errors terminate the containing subshell (and shell) Jan 22, 2025
@reubeno reubeno added the bug Something isn't working label Jan 22, 2025
@reubeno reubeno self-assigned this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants