Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssh agent forward shellenv #351

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions client/src/driver/BitbakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,15 @@ export class BitbakeDriver {

/// Execute a command in the bitbake environment
async spawnBitbakeProcess (command: string): Promise<IPty> {
const { shell, script } = this.prepareCommand(command)
const cwd = this.getBuildConfig('workingDirectory')
const shellEnv = this.getBuildConfig('shellEnv')
const { shell, shellEnv, script, workingDirectory } = this.prepareCommand(command)
await this.waitForBitbakeToFinish()
logger.debug(`Executing Bitbake command with ${shell} in ${cwd}: ${script}`)
logger.debug(`Executing Bitbake command with ${shell} in ${workingDirectory}: ${script}`)
const child = pty.spawn(
shell,
['-c', script],
{
cwd: typeof(cwd) === 'string' ? cwd : undefined,
env: { ...process.env, ...(typeof shellEnv === 'object' ? shellEnv : {}) }
cwd: workingDirectory,
env: shellEnv
}
)
this.bitbakeProcess = child
Expand Down Expand Up @@ -86,7 +84,7 @@ export class BitbakeDriver {
} {
const shell = process.env.SHELL ?? '/bin/sh'
const tempShellEnv = this.getBuildConfig('shellEnv')
const shellEnv = typeof tempShellEnv === 'object' ? tempShellEnv : {}
const shellEnv = {...process.env, ...(typeof tempShellEnv === 'object' ? tempShellEnv : {}) }
const script = this.composeBitbakeScript(command)
const tempWorkingDirectory = this.getBuildConfig('workingDirectory')
const workingDirectory = typeof tempWorkingDirectory === 'string' ? tempWorkingDirectory : '.'
Expand Down
1 change: 1 addition & 0 deletions client/src/ui/BitbakeTerminalProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class BitbakeTerminalProfileProvider implements vscode.TerminalProfilePro
shellPath: shell,
shellArgs: ['-c', script],
env: shellEnv,
strictEnv: true,
cwd: workingDirectory,
iconPath: vscode.Uri.file(path.resolve(__dirname, '../../images/yocto-view-icon.svg'))
} satisfies vscode.TerminalOptions
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"type": "string",
"examples": [
"docker run --rm -v ${workspaceFolder}:${workspaceFolder} crops/poky --workdir=${workspaceFolder} /bin/bash -c",
"kas shell -c",
"kas-container --ssh-agent shell -c",
"cqfd run",
"${workspaceFolder}/build.sh --"
],
Expand Down
Loading