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

example needed to open new WT window and launch commands "within the new window" #744

Open
surfaceowl opened this issue Feb 5, 2024 · 0 comments
Assignees

Comments

@surfaceowl
Copy link

surfaceowl commented Feb 5, 2024

Type of issue

Missing information

Feedback

Great docs on opening new windows, love it.

However there are not clear examples on how to open a new window and have commands executed within that window specifically from .bashrc, before moving onto my next WT command. Referring specifically to this page: # Windows Terminal command ref: https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=linux

Simple example - running Ubuntu 22.04, I have the following function defined in my .bashrc - I want it to open new tabs, and launch some processes in each tab.

function 1

opens multiple tabs needed to run project locally

function launch_nice_new_tabs_for_my_scripts() {
    wt.exe -w 0 new-tab --title window_01 --tabColor '#4d658d';
    wt.exe -w 0 new-tab --title window_02_client --tabColor '#468b76' -p "ubuntu-22.04-dev";
    wt.exe -w 0 new-tab --title window_03_daemon --tabColor '#7484a6' -p "ubuntu-22.04-dev";
    wt.exe -w 0 new-tab --title server --tabColor '#aa5f37' -p "ubuntu-22.04-dev";
    wt.exe focus-tab -t 1
}

function 2

opens multiple tabs needed to run project locally - but fails to launch any process

function launch_my_stuff_in_new_windows_v2() {

    wt.exe -w 0 new-tab --title window_01 --tabColor '#4d658d';
    wt.exe -w 0 new-tab --title window_02_client --tabColor '#468b76' -p "ubuntu-22.04-dev" -c function_in_my_bashrc_file;
    wt.exe -w 0 new-tab --title window_03_daemon --tabColor '#7484a6' -p "ubuntu-22.04-dev" -c another_function_in_my_bashrc;
    wt.exe -w 0 new-tab --title server --tabColor '#aa5f37' -p "ubuntu-22.04-dev" -c npm start;
    wt.exe focus-tab -t 1
}

function 2 -- launch_my_stuff_in_new_windows_v2 gives error:

error 2147942402 (0x80070002) when launching `function_in_my_bashrc_file']

All the other functions in my .bashrc work, and I'm able to run them directly from each of the new tabs I've been able to get a process launched in the original tab I called launch_my_stuff_in_new_windows from, but that's not the goal. I need separate processes launched in each tab.

ideas?

Page URL

https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=linux

Content source URL

https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=linux

Author

@nguyen-dows

Document Id

0d5d0fe3-01ef-66e8-263d-a0a7852ffa7a

@mattwojo mattwojo self-assigned this Feb 22, 2024
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

No branches or pull requests

2 participants