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

Add a short sleep to tail of postStartCommand #8536

Closed
JamesHutchison opened this issue May 25, 2023 · 5 comments
Closed

Add a short sleep to tail of postStartCommand #8536

JamesHutchison opened this issue May 25, 2023 · 5 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality

Comments

@JamesHutchison
Copy link

JamesHutchison commented May 25, 2023

The postStartCommand will execute the given command and then the parent process will abruptly terminate. This creates issues with executing background tasks. Take this bash script that is executed for example:

#!/usr/bin/env bash

# run in the background at startup
nohup bash .devcontainer/postStartBackground.sh > ".dev_container_logs/postStartBackground.out" &

What behavior would you expect to happen here?

What does happen is that postStartBackground.out is created, but nothing is actually executed. The workaround is to add a sleep at the end of the script. My suggestion is to wrap the postStartCommand such that it also gives time for any background programs to execute.

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label May 25, 2023
@bamurtaugh bamurtaugh added containers Issue in vscode-remote containers and removed ssh Issue in vscode-remote SSH labels May 31, 2023
@chrmarti
Copy link
Contributor

chrmarti commented Jun 1, 2023

Spawning the background process after nohup seems to make it work:

nohup bash -c '.devcontainer/postStartBackground.sh &' > ".dev_container_logs/postStartBackground.out"

Could you give that a try?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Jun 1, 2023
@JamesHutchison
Copy link
Author

I'm sure that works, but it isn't really the point of this suggestion. If someone does background the nohup (or any other process) as the last command, there isn't a linter or anything to help them out, and it's easy to do. Likewise, it's difficult to reproduce since things run fine from within a user shell. A good UX is preventing user errors.

@chrmarti chrmarti added feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Jun 1, 2023
@vscodenpa vscodenpa added this to the Backlog Candidates milestone Jun 1, 2023
@vscodenpa
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa
Copy link

This feature request has not yet received the 10 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

@vscodenpa
Copy link

🙁 In the last 60 days, this feature request has received less than 10 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants