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

fix: adds debug info to install reload + fix sh source #336

Closed
wants to merge 2 commits into from

Conversation

EverlastingBugstopper
Copy link
Contributor

followup to #318 - this adds some debug info, and changes the source command to just . so that it also works on posix shells.

@abernix if you could check out this branch locally and run cargo run -- install --force -l debug, test if it works without a terminal reload? if it's still broken the logs should give us some more info about what's going on.

@abernix
Copy link
Member

abernix commented Mar 11, 2021

@EverlastingBugstopper Works immediately after install! 🎉 But note this is in my ~/.zshenv with its extra quotesies:

image

@EverlastingBugstopper
Copy link
Contributor Author

ooh - good catch. should be all patched up now.

@abernix
Copy link
Member

abernix commented Mar 12, 2021

Hmm, ok, not sure how but I'm back to having source "/path" in the ~/.zshenv and it doesn't work after installation?:

$ git rev-parse HEAD
a78581275daca3f98f0d03b25f157e070a79e73b
$ rover
zsh: command not found: rover
$ grep rover ~/.zshenv
$ cargo run -- install --force -l debug
   Compiling rover v0.0.3 (/home/jesse/Dev/apollo/apollo-platform-devkit/packages/rover)
    Finished dev [unoptimized + debuginfo] target(s) in 14.85s
     Running `target/debug/rover install --force -l debug`
   rover::utils::telemetry: serialized_command: Command { name: "install", arguments: {"force": Bool(true)} }
    at src/utils/telemetry.rs:78

   rover::utils::telemetry: is_telemetry_disabled: false
    at src/utils/telemetry.rs:85

   rover::utils::version: Time since last update check: 0h
    at src/utils/version.rs:33

   rover::utils::version: No need to check for updates. Automatic checks happen once per day
    at src/utils/version.rs:41

   binstall::install: Creating directory for binary
    at installers/binstall/src/install.rs:34

Writing binary to /home/jesse/.rover/bin/rover
   binstall::install: copying from: /home/jesse/Dev/apollo/apollo-platform-devkit/packages/rover/target/debug/rover
    at installers/binstall/src/install.rs:74

   binstall::install: copying to: /home/jesse/.rover/bin/rover
    at installers/binstall/src/install.rs:75

   binstall::install: Adding binary to PATH
    at installers/binstall/src/install.rs:40

   binstall::system::unix: Successfully sourced "sh".
    at installers/binstall/src/system/unix.rs:39

   binstall::system::unix: Successfully sourced "bash".
    at installers/binstall/src/system/unix.rs:39

   binstall::system::unix: updating /home/jesse/.zshenv
    at installers/binstall/src/system/unix.rs:18

   binstall::system::unix: Successfully sourced "zsh".
    at installers/binstall/src/system/unix.rs:39

rover was successfully installed to `/home/jesse/.rover/bin/rover`.
$ rover --version
zsh: command not found: rover
$ grep rover ~/.zshenv
source "/home/jesse/.rover/env"
$

@EverlastingBugstopper
Copy link
Contributor Author

EverlastingBugstopper commented Mar 15, 2021

been trying to get this to work pretty much all day - i'm able to reproduce and confirm it doesn't reload properly on MacOS.

things i've tried:

  • running sh -c . /path/to/rover where sh could be sh, bash, and zsh
  • running sh -c source /path/to/rover where sh could be sh, bash, and zsh
  • only running $SHELL -c . /path/to/rover based on the environment variable that actually exists
  • getting the old $PATH, prepending /path/to/rover, and running sh -c export PATH=/path/to/rover:$OLDPATH
  • getting the old $PATH, prepending /path/to/rover, and then running env::set_var(rover_plus_old_path)

none of this seems to work and i'm not sure how i ever thought it did...

@EverlastingBugstopper
Copy link
Contributor Author

EverlastingBugstopper commented Mar 17, 2021

I think the issue is that when we invoke sh -c ". ~/.rover/env, it's doing that in a child process. when the fork() syscall happens, it creates a copy of the parent processes environment. it can then modify it's own copy of that environment, but once that child process is killed that copy of the environment with rover properly sourced just vanishes.

I really... don't know how to work around this! It seems to be a solved problem with other tools maybe but I can't seem to find any blog posts or straightforward examples as to how this is done with most installers. Labelling this as blocked - we should maybe reconsider adding the "You may need to reload your terminal" message if we detect this is a fresh install.

@EverlastingBugstopper
Copy link
Contributor Author

closed in favor of #406

@EverlastingBugstopper EverlastingBugstopper deleted the avery/debug-installer branch May 3, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants