Skip to content

Commit

Permalink
Fix: types in client/src/driver/BitbakeDriver.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
idillon-sfl committed Sep 17, 2024
1 parent 3f796b8 commit 294f770
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions client/src/driver/BitbakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class BitbakeDriver {
})
}

private getBuildConfig (property: keyof BitbakeBuildConfigSettings): string | NodeJS.Dict<string> | undefined {
getBuildConfig (property: keyof BitbakeBuildConfigSettings): string | NodeJS.Dict<string> | undefined {
return getBuildSetting(this.bitbakeSettings, this.activeBuildConfiguration, property)
}

Expand Down Expand Up @@ -80,14 +80,16 @@ export class BitbakeDriver {

prepareCommand (command: string): {
shell: string
shellEnv: Record<string, string>
shellEnv: NodeJS.Dict<string>
script: string
workingDirectory: string | undefined
} {
const shell = process.env.SHELL ?? '/bin/sh'
const shellEnv = this.getBuildConfig('shellEnv')
const tempShellEnv = this.getBuildConfig('shellEnv')
const shellEnv = typeof tempShellEnv === 'object' ? tempShellEnv : {}
const script = this.composeBitbakeScript(command)
const workingDirectory = this.getBuildConfig('workingDirectory') ?? '.'
const tempWorkingDirectory = this.getBuildConfig('workingDirectory')
const workingDirectory = typeof tempWorkingDirectory === 'string' ? tempWorkingDirectory : '.'
return { shell, shellEnv, script, workingDirectory }
}

Expand Down Expand Up @@ -130,7 +132,8 @@ export class BitbakeDriver {
return false
}

if ((this.getBuildConfig('workingDirectory') != null) && !fs.existsSync(this.getBuildConfig('workingDirectory'))) {
const workingDirectory = this.getBuildConfig('workingDirectory')
if (typeof workingDirectory === 'string' && !fs.existsSync(workingDirectory)) {
// If it is not defined, then we will use the workspace folder which is always valid
clientNotificationManager.showBitbakeSettingsError('Working directory does not exist.')
return false
Expand Down

0 comments on commit 294f770

Please sign in to comment.