summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjin Jeong <yeongjin.jeong@navercorp.com>2019-07-29 12:22:55 +0900
committerNirbheek Chauhan <nirbheek@centricular.com>2020-01-04 07:40:55 +0530
commitcbf56415c76d60a14b347783f941aba43991e6ac (patch)
tree87c631d45961af6da203b0936dbf56640fde2c6c
parentd344fa9a96920fad28e319a815720d6478c60a61 (diff)
uninstalled: Ensure bash prompt override even if bash script file does not exist
If automatic bash prompt override is enabled via the 'GST_BUILD_DISABLE_PS1_OVERRIDE', We should set the bash prompt to have a visual indicator of the "gst-uninstalled" environment even if bash script file does not exist.
-rwxr-xr-xgst-uninstalled.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/gst-uninstalled.py b/gst-uninstalled.py
index af3e637..40afad7 100755
--- a/gst-uninstalled.py
+++ b/gst-uninstalled.py
@@ -305,16 +305,16 @@ if __name__ == "__main__":
else:
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
if "bash" in args[0] and not strtobool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
+ tmprc = tempfile.NamedTemporaryFile(mode='w')
bashrc = os.path.expanduser('~/.bashrc')
if os.path.exists(bashrc):
- tmprc = tempfile.NamedTemporaryFile(mode='w')
with open(bashrc, 'r') as src:
shutil.copyfileobj(src, tmprc)
- tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version)
- tmprc.flush()
- # Let the GC remove the tmp file
- args.append("--rcfile")
- args.append(tmprc.name)
+ tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version)
+ tmprc.flush()
+ # Let the GC remove the tmp file
+ args.append("--rcfile")
+ args.append(tmprc.name)
try:
exit(subprocess.call(args, close_fds=False,
env=get_subprocess_env(options, gst_version)))