From 8164d673e09fb2e3d03c288a3ff72e77d7c63845 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 17 Jul 2016 15:05:08 -0600 Subject: [PATCH] Add an option for a non-login shell to be run (#192) * Add an option for a non-login shell to be run By default, however, the user's login shell will be used * Reset shell default to empty string, and improve documentation --- config-default.js | 6 +++++- index.js | 4 +++- session.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config-default.js b/config-default.js index 158e633b..fdf2f036 100644 --- a/config-default.js +++ b/config-default.js @@ -46,7 +46,11 @@ module.exports = { '#cc00ff', '#00ffff', '#ffffff' - ] + ], + + // the shell to run when spawning a new session (i.e. /usr/local/bin/fish) + // if left empty, your system's login shell will be used by default + shell: '' }, // a list of plugins to fetch and install from npm diff --git a/index.js b/index.js index 9d864a7e..60a83583 100644 --- a/index.js +++ b/index.js @@ -82,7 +82,9 @@ app.on('ready', () => { }); rpc.on('new', ({ rows = 40, cols = 100, cwd = process.env.HOME }) => { - initSession({ rows, cols, cwd }, (uid, session) => { + const shell = cfg.shell; + + initSession({ rows, cols, cwd, shell }, (uid, session) => { sessions.set(uid, session); rpc.emit('session add', { uid, diff --git a/session.js b/session.js index 81f17d99..3856509b 100644 --- a/session.js +++ b/session.js @@ -18,9 +18,9 @@ const TITLE_POLL_INTERVAL = 500; module.exports = class Session extends EventEmitter { - constructor ({ rows, cols: columns, cwd }) { + constructor ({ rows, cols: columns, cwd, shell }) { super(); - this.pty = spawn(defaultShell, ['--login'], { + this.pty = spawn(shell || defaultShell, ['--login'], { columns, rows, cwd,