-
Notifications
You must be signed in to change notification settings - Fork 1
fix: make install scripts usable immediately without terminal restart #433
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,10 @@ try { | |
| $UserPath = [Environment]::GetEnvironmentVariable("PATH", "User") | ||
| if ($UserPath -notlike "*$InstallDir*") { | ||
| [Environment]::SetEnvironmentVariable("PATH", "$UserPath;$InstallDir", "User") | ||
| Write-Host "Added $InstallDir to user PATH (restart your terminal to use 'synthorg' directly)." | ||
| Write-Host "Added $InstallDir to user PATH." | ||
| } | ||
| if ($env:PATH -notlike "*$InstallDir*") { | ||
| $env:PATH = "$env:PATH;$InstallDir" | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| & (Join-Path $InstallDir $BinaryName) version | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -112,4 +112,19 @@ fi | |||||
| echo "" | ||||||
| "${INSTALL_DIR}/${BINARY_NAME}" version | ||||||
| echo "" | ||||||
|
|
||||||
| # Warn if INSTALL_DIR is not in PATH. | ||||||
| case ":${PATH}:" in | ||||||
| *":${INSTALL_DIR}:"*) ;; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check for
Suggested change
|
||||||
| *) | ||||||
| echo "Warning: ${INSTALL_DIR} is not in your PATH." | ||||||
| echo "Add it by running:" | ||||||
| echo "" | ||||||
| echo " export PATH=\"${INSTALL_DIR}:\$PATH\"" | ||||||
| echo "" | ||||||
| echo "To make it permanent, add that line to your shell profile (~/.bashrc, ~/.zshrc, etc.)." | ||||||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||||||
| echo "" | ||||||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||||||
| ;; | ||||||
| esac | ||||||
|
Comment on lines
+116
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PATH check reflects the installer subprocess's PATH, not the user's interactive shell When the script is run via
This is an inherent limitation of piped installers and is hard to work around completely, but it may be worth adding a brief caveat to the warning message such as Prompt To Fix With AIThis is a comment left during a code review.
Path: cli/scripts/install.sh
Line: 116-128
Comment:
**PATH check reflects the installer subprocess's PATH, not the user's interactive shell**
When the script is run via `curl … | bash`, the spawned bash process inherits `PATH` from whatever invoked `curl` (e.g. a cron job, a CI runner, a minimal Docker container), not necessarily from the user's interactive login shell. This means:
- A false positive is possible: the warning fires even though the directory _is_ in the user's interactive `~/.profile`-sourced `PATH`.
- A false negative is possible: no warning fires because the parent process happened to have that directory in its `PATH`, even though the user's interactive shell does not.
This is an inherent limitation of piped installers and is hard to work around completely, but it may be worth adding a brief caveat to the warning message such as `"(checked against the current process PATH)"` so users aren't confused when `which synthorg` works in a new terminal despite the warning having fired.
How can I resolve this? If you propose a fix, please make it concise. |
||||||
|
|
||||||
| echo "SynthOrg CLI installed successfully. Run 'synthorg init' to get started." | ||||||
Uh oh!
There was an error while loading. Please reload this page.