Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

terminal is reloaded while starting termtosvg #20

Closed
SiteshSahoo opened this issue Jul 4, 2018 · 7 comments
Closed

terminal is reloaded while starting termtosvg #20

SiteshSahoo opened this issue Jul 4, 2018 · 7 comments
Labels
enhancement New feature or request

Comments

@SiteshSahoo
Copy link

Hi,

Whenever termtosvg is started the .bashrc is reloaded.
Can this be avoided ?

  • Thanks
@nbedos
Copy link
Owner

nbedos commented Jul 4, 2018

On startup termtosvg creates a new shell and this shell loads all the usual configuration files. This way you have all your usual settings and aliases.

Why should loading ~/.bashrc be avoided?

@SiteshSahoo
Copy link
Author

One simple reason to avoid this is, working in different environment/setup would need some specific settings and loading ~/.bashrc again will set those to default value...
Ex :
Working in different projects in parallel. And in .bashrc, the DEFAULT_WORKING_DIR = Project1. When I switched to Project2 and try to use termtosvg again I need to repeat all these Project2 specific settings. Which is an overhead.

@nbedos
Copy link
Owner

nbedos commented Jul 5, 2018

Seems quite specific, I don't think it should be the default behavior of termtosvg.

A solution would be to provide a --command option so that you could run:

termtosvg --command '/bin/bash --norc'

This would make termtosvg run '/bin/bash --norc' instead of $SHELL which would prevent bash from loading the configuration files. It could also be useful in other cases (recording a Python interpreter directly so that the call to python or ipython is not shown in the animation).

@nbedos nbedos added the enhancement New feature or request label Jul 5, 2018
@SiteshSahoo
Copy link
Author

The problem is more serious than it looks. I would never want to record (even if execution is not a major issue) my pre configuration commands to svg file each time I use this utility. This will simply be irrelevant and not useful. So I feel this should be considered as a fault than enhancement.

Configurable option should be fine .. but again the question is about the default behavior (Whether to enable or disable this by default). Is there a real need to create a fresh shell always?

@nbedos
Copy link
Owner

nbedos commented Jul 5, 2018

Basically termtosvg sits between the shell that called it and the new shell it spawns so that it can capture all I/O of the 'new' shell. This is the only way I know of to capture all I/O of a shell.

@ylmrx
Copy link

ylmrx commented Jul 9, 2018

Several things you probably wanna try :

no home

HOME=/tmp termtosvg

bash won't find the .bashrc and keep every you had in your previous environment (it'll fail to find your user-configs when launching programs so you'll have to specify them manually when lauching them)

no bash

SHELL=sh termtosvg

it's another shell, it should be default... and still will carry your previous env.

protip : don't do this with sh as it has quite a hard default behavior, install zsh maybe

no weird bashrc

You definitely shouldn't have some project specific variables in a new bash session.
Maybe you wanna have these in a separate file, and run "source [FILE]" when in the new shell.

@nbedos
Copy link
Owner

nbedos commented Dec 3, 2018

The workaround for this is to call termtosvg -c '/bin/bash --norc' (or something similar) in order to prevent the shell from reading ~/.bashrc.

See #83 and #84 for details about the -c option.

@nbedos nbedos closed this as completed Dec 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants