-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export an additional env var pointing to the location of jbang (#…
…1811) * feat: export an env var with the location of jbang It's *really* hard (impossible?) to find the location of the script that launched the JVM from within jbang. It would be really useful to be able to do that so you can run jbang again with some logic to precompute the command line. This works really simply: ``` $ jbang --interactive WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign | Welcome to JShell -- Version 17.0.7 | For an introduction type: /help intro jshell> System.getenv("JBANG") $1 ==> "/home/dsyer/.sdkman/candidates/jbang/current/bin/jbang" ``` * Add JBANG_LAUNCH_CMD + tests for other env variables * fix: check out instead of err for env results --------- Co-authored-by: Max Rydahl Andersen <[email protected]>
- Loading branch information
1 parent
d863c33
commit a2ef5a7
Showing
4 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feature: env variables | ||
|
||
Scenario: JBANG_RUNTIME_SHELL available | ||
When command('jbang env@jbangdev JBANG') | ||
Then match out contains "JBANG_RUNTIME_SHELL" | ||
|
||
Scenario: JBANG_STDIN_NOTTY available | ||
When command('jbang env@jbangdev JBANG') | ||
Then match out contains "JBANG_STDIN_NOTTY" | ||
|
||
Scenario: JBANG_LAUNCH_CMD available | ||
When command('jbang env@jbangdev JBANG') | ||
Then match out contains "JBANG_LAUNCH_CMD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters