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

Bypass "Press any key to continue" prompt from shell.openTab #2083

Open
GitMrMeeseeks opened this issue Jan 30, 2025 · 3 comments
Open

Bypass "Press any key to continue" prompt from shell.openTab #2083

GitMrMeeseeks opened this issue Jan 30, 2025 · 3 comments
Labels
area-CraftOS This affects CraftOS, or any other Lua portions of the mod. enhancement An extension of a feature or a new feature.

Comments

@GitMrMeeseeks
Copy link

I am using shell.openTab to launch scripts many times that might only last a few seconds. They do not go away without user input. I want to be able to close those tabs when the script is done running, otherwise I end up with 100s of tabs. They simply stay on "Press any key to continue".

@GitMrMeeseeks GitMrMeeseeks added the enhancement An extension of a feature or a new feature. label Jan 30, 2025
@zyxkad
Copy link
Contributor

zyxkad commented Jan 31, 2025

You can use multishell.setFocus to set the focus and then set the focus back to prevent that.

For example:

local currentTabId = multishell.getFocus()

local newTabId = shell.openTab('hello')
multishell.setFocus(newTabId)
multishell.setFocus(currentTabId)

@zyxkad
Copy link
Contributor

zyxkad commented Jan 31, 2025

But in advance, if you want to complete prevent the tab being showed on terminal, you should directly invoke os.run with coroutine or parallel

@SquidDev
Copy link
Member

I am using shell.openTab to launch scripts many times

Hrmr, that feels like a bit of an anti-pattern. Do these need to be external scripts, or would it be cleaner to write them as functions, and then use a coroutine manager for parallelism? Would you be able to share your code, might help make this a little clearer.

@SquidDev SquidDev added the area-CraftOS This affects CraftOS, or any other Lua portions of the mod. label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CraftOS This affects CraftOS, or any other Lua portions of the mod. enhancement An extension of a feature or a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants