Support Windows Terminal's -d parameter and other "starting folder" behaviors
Categories
(Firefox Build System :: MozillaBuild, defect)
Tracking
(Not tracked)
People
(Reporter: aminomancer, Assigned: mhentges)
References
Details
Attachments
(2 files)
Windows Terminal has a command line parameter -d
whereby the user can open a shell to a chosen folder, e.g., wt -d C:\mozilla-source\mozilla-central
. This works for other unix shells integrated within Windows Terminal, but not for MozillaBuild shell.
Windows Terminal has a settings GUI that lets you create a profile for a shell. If you choose MozillaBuild's start-shell.bat as the shell, it works great. But within this GUI there's 1) an option to set the starting directory to some absolute path or environment path variable, and 2) an option to "Use parent process directory," meaning the shell will open in the working directory from which Windows Terminal was invoked.
Neither of these behaviors works with MozillaBuild shell, I think because the shell is jumping to the $HOME directory after the fact. It's possible to add your own static "starting directory" by making a file $HOME/.profile
with contents like cd C:\mozilla-source\mozilla-central
but I'm not aware of any straightforward way to make this dynamic such that it supports the -d parameter or the WT starting directory settings.
Assignee | ||
Comment 1•3 years ago
|
||
msys2_shell.cmd
provides a -here
option, so there's ways to work around the cwd
-resetting.
I'll play with this a bit, we should be able to include this for 4.0.
Assignee | ||
Comment 2•3 years ago
|
||
For developers who prefer the Command Prompt instead of MinTTY as their
terminal, or those who don't want their $PATH
reset, pass through
options to msys2_shell.cmd
.
Users can enumerate MSYS2's options with start-shell.bat -help
.
Note that this breaks the start-shell.bat <bash commands>
use case,
which will need to be ported to start-shell.bat -c <bash commands>
(or, more correctly,
start-shell.bat -no-start -defterm -c <bash commands>
).
Fortunately, that case was rare, so impact should be minor.
Depends on D135186
Assignee | ||
Comment 3•3 years ago
|
||
Explicit docs around Windows Terminal support are in the pipeline, but this change should work for ya.
A couple things:
- You'll need to wait for the release of MozillaBuild 4.0 to be able to leverage this improvement
- In your Windows Terminal profile for MozillaBuild, set
"commandline": "C:/mozilla-build/start-shell.bat -no-start -defterm -here"
.
Reporter | ||
Comment 4•3 years ago
|
||
Awesome!
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 5•3 years ago
|
||
For a little bit, compatibility with MACH_PS1_USE_MOZILLABUILD
will be
maintained, though the recent work in bug 1740123 should entirely
obsolete it. It's staying around //for now// so that regressions in
1740123 don't unnecessarily impede workflows.
However, MACH_PS1_USE_MOZILLABUILD
has some serious drawbacks already
(can't have whitespace in arguments, can't pass braces to Mach, etc).
This patch still has these drawbacks, because they're tricky to solve.
In a couple months, once bug 1740123 has settled nicely, we'll remove
support for MACH_PS1_USE_MOZILLABUILD
.
Depends on D136286
Comment 7•3 years ago
|
||
bugherder |
Reporter | ||
Comment 9•3 years ago
•
|
||
I just tried 4.0 and followed the windows terminal instructions but it doesn't seem to work for me. Always opens in mozilla-central.
{
"name": "MozillaBuild",
"commandline": "C:/mozilla-build/start-shell.bat -here",
"startingDirectory": "C:\\",
}
Same thing with wt -d C:\
, with or without the startingDirectory parameter. I also tried C:/mozilla-build/start-shell.bat -no-start -defterm -here
with the same results.
Edit: Ignore the above, this is my own fault. Before 4.0, I added cd C:/mozilla-source/mozilla-central;
to my .bash_profile to serve the same purpose as the startingDirectory parameter, and forgot I did so.
Btw idk if this is due to something I did, but I used to be able to run mach build
(like without the ./
) but now it returns bash: mach: command not found
unless I use ./mach build
.
Edit: If anyone else is missing the same ^ try adding this line to your .bashrc/.bash_profile file: alias mach="./mach";
Assignee | ||
Comment 10•3 years ago
|
||
Btw idk if this is due to something I did, but I used to be able to run mach build (like without the ./) but now it returns bash: mach: command not found unless I use ./mach build.
FWIW, I'd recommend running ./mach
with the explicit relative path (./
), to avoid issues where the wrong mach
is implicitly called (such as if you have multiple checkouts, and one of them is added the $PATH
for unrelated reasons). There's a little more discussion around this in this patch.
Updated•2 years ago
|
Description
•