Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit fec17e8

Browse files
committed
fix(plugins/plugin-bash-like): in browser client-server configs, env is lost in cd
Fixes #5659
1 parent 636282f commit fec17e8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

plugins/plugin-bash-like/src/pty/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export const onConnection = (exitNow: ExitHandler, uid?: number, gid?: number) =
329329
// eslint-disable-next-line no-async-promise-executor
330330
shells[msg.uuid] = new Promise(async (resolve, reject) => {
331331
try {
332-
const env = Object.assign({}, msg.env || process.env, { KUI: 'true' })
332+
const env = Object.assign({}, process.env, msg.env, { KUI: 'true' })
333333
if (process.env.DEBUG && (!msg.env || !msg.env.DEBUG)) {
334334
// don't pass DEBUG unless the user asked for it!
335335
delete env.DEBUG

plugins/plugin-bash-like/src/test/bash-like/export.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 IBM Corporation
2+
* Copyright 2019-20 IBM Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,6 +35,14 @@ describe('export command', function(this: Common.ISuite) {
3535
after(Common.after(this))
3636
Util.closeAllExceptFirstTab.bind(this)()
3737

38+
Common.pit(`should cd and still have a value for HOME`, () =>
39+
CLI.command('cd', this.app)
40+
.then(ReplExpect.okWithAny)
41+
.then(() => CLI.command('pwd', this.app).then(ReplExpect.okWithPtyOutput(process.env.HOME)))
42+
.then(() => CLI.command('printenv HOME', this.app).then(ReplExpect.okWithPtyOutput(process.env.HOME)))
43+
.catch(Common.oops(this))
44+
)
45+
3846
Common.pit(`should fail with export without args`, () =>
3947
CLI.command(`export`, this.app)
4048
.then(ReplExpect.error(497))

0 commit comments

Comments
 (0)