Bug 1756495 - Ensure script registration is complete when a new process is spawned...
[gecko.git] / mach.ps1
blobe42b02f38c1afc9989f1d3d1e4950826f24d17a6
1 $mypath = $MyInvocation.MyCommand.Path
2 $machpath = $mypath.substring(0, $mypath.length - 4)
4 if (Get-Command py) {
5 $python_executable = "py"
6 } else {
7 $python_executable = "python"
10 if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) {
11 &$python_executable $machpath $args
12 exit $lastexitcode
15 if (-not (test-path env:MOZILLABUILD)) {
16 echo "No MOZILLABUILD environment variable found, terminating."
17 exit 1
20 $machpath = ($machpath -replace '\\', '/')
22 if ($machpath.contains(' ')) {
23 echo @'
24 The repository path contains whitespace which currently isn't supported in mach.ps1.
25 Please run MozillaBuild manually for now.
27 exit 1
30 for ($i = 0; $i -lt $args.length; $i++) {
31 $arg = $args[$i]
32 if ($arg.contains(' ')) {
33 echo @'
34 The command contains whitespace which currently isn't supported in mach.ps1.
35 Please run MozillaBuild manually for now.
37 exit 1
41 $mozillabuild_version = Get-Content "$env:MOZILLABUILD\VERSION"
42 # Remove "preX" postfix if the current MozillaBuild is a prerelease.
43 $mozillabuild_version = [decimal]($mozillabuild_version -replace "pre.*")
45 if ($mozillabuild_version -ge 4.0) {
46 & "$env:MOZILLABUILD/start-shell.bat" -no-start -defterm -c "$machpath $args"
47 } else {
48 & "$env:MOZILLABUILD/start-shell.bat" $machpath $args
50 exit $lastexitcode