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

Commit ddedd2e

Browse files
committed
fix(plugins/plugin-client-common): export can fail if command line ends with semicolon
1 parent c5dfbb5 commit ddedd2e

File tree

1 file changed

+4
-1
lines changed
  • plugins/plugin-bash-like/src/lib/cmds

1 file changed

+4
-1
lines changed

plugins/plugin-bash-like/src/lib/cmds/export.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ const exportCommand = async (args: Arguments) => {
2929
const arr = toBeParsed.split('=')
3030
const key = arr[0]
3131

32-
const myArgs = Object.assign({}, args, { command: `${command}; echo -n $${key}` })
32+
// only add a semicolon if needed
33+
const semicolon = /;\s*$/.test(command) ? '' : ';'
34+
35+
const myArgs = Object.assign({}, args, { command: `${command}${semicolon} echo -n $${key}` })
3336
const value = await doExecWithStdoutViaPty(myArgs)
3437
curDic[key] = value
3538

0 commit comments

Comments
 (0)