Skip to content

[BUG]: Failed to switch environment in external bash script file #253

Closed

Description

@imknn

Version
0.4.2
OS
Linux

Describe the bug
在bash脚本中使用 vfox use -s [email protected]+8,打印出来还是之前版本的jdk

默认版本

image

创建一个demo.sh脚本,内容如下

image
打印结果如下,没有成功切换版本

image

Activity

  1. added
    bug
    on May 7, 2024
  2. changed the title [-][BUG]: Some problem...[/-] [+][BUG]: 外部bash脚本文件中切换环境失败[/+] on May 7, 2024
  3. aooohan commented on May 9, 2024

    @aooohan
    Member

    因为vfox的机制是利用shell hook进行刷新. 你这么写shell是不会执行hook的. 所以需要手动刷新一下.

    参考下面的配置.

    https://github.com/version-fox/vfox-php/blob/ab95a5a317c6e5f7fc9e8622c3978c14d890ce35/.github/workflows/test-linux.yaml#L34-L37

    另外你的使用场景是什么?

  4. imknn commented on May 9, 2024

    @imknn
    Author

    我需要的功能是:在shell脚本中切换jdk版本,进行不同java项目的打包。我以为这种需求应该很常用吧?

  5. imknn commented on May 9, 2024

    @imknn
    Author

    手动刷新是可以的,但是感觉有些麻烦。

    image

    image

  6. aooohan commented on May 9, 2024

    @aooohan
    Member

    我需要的功能是:在shell脚本中切换jdk版本,进行不同java项目的打包。我以为这种需求应该很常用吧?

    是的, 有解决方案了. 0.5.0下个版本修复.

  7. changed the title [-][BUG]: 外部bash脚本文件中切换环境失败[/-] [+][BUG]: Failed to switch environment in external bash script file[/+] on May 9, 2024
  8. added this to the 0.5.0 milestone on May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions