Skip to content

async commands (&) run via -c aren't spawned before brush exits #1079

Description

@ArtikusHG

brush version

sh -c -- fix debug build

bash version (for comparison)

5.3.0

Platform / OS

Linux

Steps to reproduce

brush -c "some-command &" - does not run at all

Actual behavior (brush)

When trying to run a command with -c that has an & symbol at the end, the command doesn't run. If there's another command after it, it does run, but the commands run in a seemingly random order, sometimes some of them don't run at all.

[~] sh -c "echo 1"
1
[~] sh -c "echo 1 &" # no output :(
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
1
2
3
4
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
4
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
4
1
2
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
1
4
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
4
2
1
[~] sh -c "echo 1 & echo 2 & echo 3 & echo 4"
4
1
2

Note that in an interactive shell both running a single command and multiple commands works fine.

From my understanding, the fact that they're in random order is expected, but the fact that sometimes only some of them run isn't great, and the fact that if I try to run a single command in the background, it simply ignores that request, prevents me from being able to use a lockscreen using swayidle.

Expected behavior

commands with & run correctly, just like in interactive shell

Additional context

Sorry for the load of bug reports :/ I'm probably the only one crazy enough to try to use this as their system shell lol

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compatRelated to compatibility with standard shellsarea: jobsIssues or PRs related to job/process managementbugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions