From 5fcf250c04252628d6f25c4648ce9d42d3691e53 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Thu, 21 Jul 2016 20:27:07 -0700 Subject: [PATCH] add `TERM_PROGRAM` and `TERM_PROGRAM_VERSION` env vars (#350) * add `TERM_PROGRAM` and `TERM_PROGRAM_VERSION` env vars MacOS's Terminal.app sets these same env variables. They're useful to be able to sniff out the type of terminal emulator and do different settings in your bashrc / vimrc / etc. configuration files. So for example, `TERM_PROGRAM` will be "HyperTerm", and `TERM_PROGRAM_VERSION` will be the value from `package.json/version`. * fix require package.json path --- session.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/session.js b/session.js index 23811e60..77109aaf 100644 --- a/session.js +++ b/session.js @@ -2,6 +2,7 @@ const { app } = require('electron'); const { EventEmitter } = require('events'); const { exec } = require('child_process'); const defaultShell = require('default-shell'); +const { productName, version } = require('./package'); let spawn; try { @@ -27,7 +28,9 @@ module.exports = class Session extends EventEmitter { cwd, env: Object.assign({}, process.env, { LANG: app.getLocale(), - TERM: 'xterm-256color' + TERM: 'xterm-256color', + TERM_PROGRAM: productName, + TERM_PROGRAM_VERSION: version }) });