Added shellArgs to the config. (#572)

In case someone wants to use non-login shells there is a field added to
the configuration file.
If shellArgs not set default shell will be used as before.

i.e. for using interactive shell (and use .bashrc instead of
.bash_profile on linux) use shellArgs: ['-i'] and shell: '/bin/bash'
this is useful especially if you are on Linux.
This commit is contained in:
Efe Gürkan YALAMAN 2016-08-13 22:30:17 +03:00 committed by Leo Lamprecht
parent cb651f6492
commit 77597da1d3
3 changed files with 11 additions and 4 deletions

View file

@ -56,6 +56,10 @@ module.exports = {
// if left empty, your system's login shell will be used by default
shell: '',
// for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
// by default ['--login'] will be used
shellArgs: ['--login'],
// for environment variables
env: {},

View file

@ -112,7 +112,7 @@ app.on('ready', () => {
win.webContents.send('config change');
if (cfg_.shell !== cfg.shell) {
if (cfg_.shell !== cfg.shell || cfg_.shellArgs !== cfg.shellArgs) {
notify(
'Shell configuration changed!',
'Open a new tab or window to start using the new shell'
@ -146,8 +146,9 @@ app.on('ready', () => {
rpc.on('new', ({ rows = 40, cols = 100, cwd = process.env.HOME }) => {
const shell = cfg.shell;
const shellArgs = cfg.shellArgs;
initSession({ rows, cols, cwd, shell }, (uid, session) => {
initSession({ rows, cols, cwd, shell, shellArgs }, (uid, session) => {
sessions.set(uid, session);
rpc.emit('session add', {
uid,

View file

@ -24,7 +24,7 @@ const envFromConfig = config.getConfig().env || {};
module.exports = class Session extends EventEmitter {
constructor ({ rows, cols: columns, cwd, shell }) {
constructor ({ rows, cols: columns, cwd, shell, shellArgs }) {
super();
const baseEnv = Object.assign({}, process.env, {
LANG: app.getLocale().replace('-', '_') + '.UTF-8',
@ -33,7 +33,9 @@ module.exports = class Session extends EventEmitter {
TERM_PROGRAM_VERSION: version
}, envFromConfig);
this.pty = spawn(shell || defaultShell, ['--login'], {
const defaultShellArgs = ['--login'];
this.pty = spawn(shell || defaultShell, shellArgs || defaultShellArgs, {
columns,
rows,
cwd,