@@ -193,6 +193,8 @@ def run(options: argparse.Namespace) -> int:
193193 args = options .devcmd
194194 if not args :
195195 prompt_prefix = f'[{ b .project_name } ]'
196+ if os .environ .get ("MESON_DISABLE_PS1_OVERRIDE" ):
197+ prompt_prefix = None
196198 shell_env = os .environ .get ("SHELL" )
197199 # Prefer $SHELL in a MSYS2 bash despite it being Windows
198200 if shell_env and os .path .exists (shell_env ):
@@ -203,8 +205,9 @@ def run(options: argparse.Namespace) -> int:
203205 mlog .warning ('Failed to determine Windows shell, fallback to cmd.exe' )
204206 if shell in POWERSHELL_EXES :
205207 args = [shell , '-NoLogo' , '-NoExit' ]
206- prompt = f'function global:prompt {{ "{ prompt_prefix } PS " + $PWD + "> "}}'
207- args += ['-Command' , prompt ]
208+ if prompt_prefix :
209+ prompt = f'function global:prompt {{ "{ prompt_prefix } PS " + $PWD + "> "}}'
210+ args += ['-Command' , prompt ]
208211 else :
209212 args = [os .environ .get ("COMSPEC" , r"C:\WINDOWS\system32\cmd.exe" )]
210213 args += ['/k' , f'prompt { prompt_prefix } $P$G' ]
@@ -214,7 +217,7 @@ def run(options: argparse.Namespace) -> int:
214217 # Let the GC remove the tmp file
215218 tmprc = tempfile .NamedTemporaryFile (mode = 'w' )
216219 tmprc .write ('[ -e ~/.bashrc ] && . ~/.bashrc\n ' )
217- if not os . environ . get ( "MESON_DISABLE_PS1_OVERRIDE" ) :
220+ if prompt_prefix :
218221 tmprc .write (f'export PS1="{ prompt_prefix } $PS1"\n ' )
219222 for f in bash_completion_files (b , install_data ):
220223 tmprc .write (f'. "{ f } "\n ' )
0 commit comments