Closed
Bug 1799068
Opened 3 years ago
Closed 2 years ago
VS Code tasks don't work on Windows 10
Categories
(Firefox Build System :: General, defect, P3)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1858932
People
(Reporter: aminomancer, Unassigned)
References
Details
STR
- In vscode on Windows, open mozilla-central
- Open the command palette
- Type "Tasks: Run Task" and hit return
- Type "run" and hit return
Expected
The build should run
Actual
Error:
* Executing task in folder mozilla-central: /mozilla-build/start-shell.bat cd "$('C:\mozilla-source\mozilla-central' -replace '\\','/')" ';' mach --log-no-times run -purgecaches
MozillaBuild Install Directory: C:\mozilla-build\
/d: /d: Is a directory
* The terminal process "C:\mozilla-build\start-shell.bat -here /d /c /mozilla-build/start-shell.bat cd "$('C:\mozilla-source\mozilla-central' -replace '\\','/')" ';' mach --log-no-times run -purgecaches" terminated with exit code: 126.
* Terminal will be reused by tasks, press any key to close it.
I guess this isn't a permanent solution according to bug 1748762, and maybe there's a better way to fix this, but I was able to get the tasks to work like this:
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -6,14 +6,17 @@
"command": "${workspaceFolder}/mach",
"args": ["--log-no-times"],
"windows": {
- "command": "/mozilla-build/start-shell.bat",
+ "options": {
+ "shell": {
+ "executable": "PowerShell",
+ },
+ "env": {
+ "MACH_PS1_USE_MOZILLABUILD": "/mozilla-build/",
+ "MOZILLABUILD": "/mozilla-build/",
+ }
+ },
+ "command": "${workspaceFolder}/mach.ps1",
"args": [
- "cd",
- // Use PowerShell to mangle path for mozilla-build environment
- {"value": "$('${workspaceFolder}' -replace '\\\\','/')", "quoting": "weak"},
- "';'",
-
- "mach",
"--log-no-times"
]
},
diff --git a/mach.ps1 b/mach.ps1
index 51f66aeed8eb8..6d92ef8838a14 100644
--- a/mach.ps1
+++ b/mach.ps1
@@ -40,9 +40,9 @@ Please run MozillaBuild manually for now.
$mozillabuild_version = Get-Content "$env:MOZILLABUILD\VERSION"
# Remove "preX" postfix if the current MozillaBuild is a prerelease.
-$mozillabuild_version = [decimal]($mozillabuild_version -replace "pre.*")
+$mozillabuild_version = [decimal]($mozillabuild_version.split(".")[0])
-if ($mozillabuild_version -ge 4.0) {
+if ($mozillabuild_version -ge 4) {
& "$env:MOZILLABUILD/start-shell.bat" -no-start -defterm -c "$machpath $args"
} else {
& "$env:MOZILLABUILD/start-shell.bat" $machpath $args
(I also had to change mach.ps1 since MozillaBuild's current version has two dots)
| Reporter | ||
Comment 1•3 years ago
•
|
||
Oh yeah this is with a different default shell. Here is what happens if I disable all the terminal related user settings:
* Executing task in folder mozilla-central: /mozilla-build/start-shell.bat cd "$('C:\mozilla-source\mozilla-central' -replace '\\','/')" ';' mach --log-no-times run -purgecaches
MozillaBuild Install Directory: C:\mozilla-build\
/usr/bin/bash: cd: No such file or directory
* The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command /mozilla-build/start-shell.bat cd "$('C:\mozilla-source\mozilla-central' -replace '\\','/')" ';' mach --log-no-times run -purgecaches" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Mach Core' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Component: General → Mach Core
| Reporter | ||
Comment 3•3 years ago
|
||
This eliminates the errors but doesn't actually work:
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -6,8 +6,14 @@
"command": "${workspaceFolder}/mach",
"args": ["--log-no-times"],
"windows": {
+ "options": {
+ "shell": {
+ "executable": "PowerShell",
+ }
+ },
"command": "/mozilla-build/start-shell.bat",
"args": [
+ "-c",
"cd",
// Use PowerShell to mangle path for mozilla-build environment
{"value": "$('${workspaceFolder}' -replace '\\\\','/')", "quoting": "weak"},
Component: Mach Core → General
Updated•2 years ago
|
Severity: -- → S3
Priority: -- → P3
Comment 4•2 years ago
|
||
Bug 1858932 offers a fix that seems to fix this.
You need to log in
before you can comment on or make changes to this bug.
Description
•