| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6f826c3 commit 652d37f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,16 @@ import { describe, it, expect } from 'vitest'; | |||
| 2 | 2 | import { generatePrivateInstallScript, generateInstallScript } from './install-script'; | |
| 3 | 3 | ||
| 4 | 4 | describe('generatePrivateInstallScript', () => { | |
| 5 | + it('should reopen stdin from /dev/tty for curl|bash', () => { | ||
| 6 | + const script = generatePrivateInstallScript( | ||
| 7 | + 'https://openboot.dev', | ||
| 8 | + 'testuser', | ||
| 9 | + 'my-config' | ||
| 10 | + ); | ||
| 11 | + | ||
| 12 | + expect(script).toContain('exec < /dev/tty'); | ||
| 13 | + }); | ||
| 14 | + | ||
| 5 | 15 | it('should generate private install script with sanitized username and slug', () => { | |
| 6 | 16 | const script = generatePrivateInstallScript( | |
| 7 | 17 | 'https://openboot.dev', | |
@@ -100,6 +110,12 @@ describe('generatePrivateInstallScript', () => { | |||
| 100 | 110 | }); | |
| 101 | 111 | ||
| 102 | 112 | describe('generateInstallScript', () => { | |
| 113 | + it('should reopen stdin from /dev/tty for curl|bash', () => { | ||
| 114 | + const script = generateInstallScript('testuser', 'my-config', '', ''); | ||
| 115 | + | ||
| 116 | + expect(script).toContain('exec < /dev/tty'); | ||
| 117 | + }); | ||
| 118 | + | ||
| 103 | 119 | it('should generate basic install script without custom content', () => { | |
| 104 | 120 | const script = generateInstallScript('testuser', 'my-config', '', ''); | |
| 105 | 121 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,12 @@ export function generatePrivateInstallScript( | |||
| 13 | 13 | return `#!/bin/bash | |
| 14 | 14 | set -e | |
| 15 | 15 | ||
| 16 | + # When run via "curl | bash", stdin is the script content, not the terminal. | ||
| 17 | + # Reopen stdin from /dev/tty so interactive prompts (sudo, Homebrew) work. | ||
| 18 | + if [ ! -t 0 ] && [ -e /dev/tty ]; then | ||
| 19 | + exec < /dev/tty | ||
| 20 | + fi | ||
| 21 | + | ||
| 16 | 22 | echo "========================================" | |
| 17 | 23 | echo " OpenBoot - Private Config Install" | |
| 18 | 24 | echo " Config: @${safeUsername}/${safeSlug}" | |
@@ -92,6 +98,12 @@ export function generateInstallScript( | |||
| 92 | 98 | return `#!/bin/bash | |
| 93 | 99 | set -e | |
| 94 | 100 | ||
| 101 | + # When run via "curl | bash", stdin is the script content, not the terminal. | ||
| 102 | + # Reopen stdin from /dev/tty so interactive prompts (sudo, Homebrew) work. | ||
| 103 | + if [ ! -t 0 ] && [ -e /dev/tty ]; then | ||
| 104 | + exec < /dev/tty | ||
| 105 | + fi | ||
| 106 | + | ||
| 95 | 107 | echo "========================================" | |
| 96 | 108 | echo " OpenBoot - Custom Install" | |
| 97 | 109 | echo " Config: @${safeUsername}/${safeSlug}" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments