Skip to content

Commit

Permalink
fix(setup/linux): some issues with the Linux setup script (#190)
Browse files Browse the repository at this point in the history
* Set the correct target platform alias

* system.which returns null when no binary is found

* If sudo returns an error about the password, try askpass

* Add a check for undefined

Co-authored-by: Nick Hehr <[email protected]>

---------

Co-authored-by: Nick Hehr <[email protected]>
  • Loading branch information
dahenson and HipsterBrown authored Nov 27, 2024
1 parent 896ebd0 commit e5ef6eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/toolbox/prompt/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const DEVICE_ALIAS: Record<Device | 'esp8266', Device> = Object.freeze({
mac: 'mac',
windows_nt: 'win',
win: 'win',
linux: 'lin',
lin: 'lin',
linux: 'linux',
lin: 'linux',
esp: 'esp',
esp32: 'esp32',
wasm: 'wasm',
Expand Down
4 changes: 2 additions & 2 deletions src/toolbox/system/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Device } from '../../types'

function ensureAskPass(): void {
const SUDO_ASKPASS = system.which('ssh-askpass')
if (SUDO_ASKPASS === undefined) {
if (SUDO_ASKPASS === null || SUDO_ASKPASS === undefined) {
print.warning('ssh-askpass required to prompt for password')
process.exit(1)
}
Expand All @@ -27,7 +27,7 @@ export async function execWithSudo(
)
return
} catch (error) {
if (error.toString().includes('password') === false) {
if (error.toString().includes('password') === true) {
ensureAskPass()
} else {
throw error as Error
Expand Down

0 comments on commit e5ef6eb

Please sign in to comment.