Skip to content

Commit

Permalink
fix(script): get shell environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Mar 1, 2020
1 parent 1e7b382 commit 71fc188
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@guijs/server-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"os-locale": "^4.0.0",
"portfinder": "^1.0.25",
"resolve": "^1.15.1",
"shell-env": "^3.0.0",
"shortid": "^2.2.15",
"string_decoder": "^1.3.0",
"ws": "^7.2.1"
Expand Down
4 changes: 4 additions & 0 deletions packages/@guijs/server-core/src/schema/terminal/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EventEmitter } from 'events'
import consola from 'consola'
import fs from 'fs-extra'
import path from 'path'
import shellEnv from 'shell-env'
import projectPackage from '../../../package.json'
import { DataBatcher } from './data-batcher'
import { rcFolder } from '@/util/rc-folder'
Expand Down Expand Up @@ -159,9 +160,12 @@ export class Terminal extends EventEmitter {
function getPtyEnv () {
const osLocale = require('os-locale') as typeof import('os-locale')

delete process.env.npm_config_prefix

const env = Object.assign(
{},
process.env,
shellEnv.sync(),
{
LANG: `${osLocale.sync().replace(/-/, '_')}.UTF-8`,
TERM: 'xterm-256color',
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14369,6 +14369,15 @@ shebang-regex@^3.0.0:
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==

shell-env@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/shell-env/-/shell-env-3.0.0.tgz#42484ebd0798ee321ba69f6151f2aeab13fde1d4"
integrity sha512-zE0lGldowbCLnnorLnOUO6gLSwEoW4u+qWcEV1HH2qje5sIg0PvBd+8ro74EgSZv0MBEP2dROD6vSKhGDbUIMQ==
dependencies:
default-shell "^1.0.1"
execa "^1.0.0"
strip-ansi "^5.2.0"

shell-quote@^1.6.1, shell-quote@^1.7.2:
version "1.7.2"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
Expand Down

0 comments on commit 71fc188

Please sign in to comment.