diff --git a/.all-contributorsrc b/.all-contributorsrc
index c5d0ae4760..7afd67ba33 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -1523,6 +1523,15 @@
"bug"
]
},
+ {
+ "login": "dastbe",
+ "name": "David Bell",
+ "avatar_url": "https://avatars.githubusercontent.com/u/634735?v=4",
+ "profile": "https://github.com/dastbe",
+ "contributions": [
+ "code"
+ ]
+ },
{
"login": "Ragnoroct",
"name": "Will Bender",
diff --git a/README.md b/README.md
index 7f77646274..60f6464667 100644
--- a/README.md
+++ b/README.md
@@ -110,150 +110,151 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Dave Slotnick 🐛 |
+ David Bell 💻 |
Donald Stufft 🐛 💻 🤔 👀 |
Dongie Agnir 💻 👀 |
Eduardo Rabelo 📖 |
Eduardo Sena S. Rosa 🐛 |
Elad Ben-Israel 🐛 💻 🤔 🚧 👀 📢 |
Eli Polonsky 🐛 💻 🤔 🚧 👀 |
- Eric Z. Beard 📆 |
+ Eric Z. Beard 📆 |
Erik Karlsson 🐛 |
Eugene Kozlov 💻 |
Fabio Gentile 🐛 |
Florian Eitel 🤔 |
Glib Shpychka 🐛 |
Graham Lea 🤔 👀 |
- Hamza Assyad 🐛 💻 🤔 👀 |
+ Hamza Assyad 🐛 💻 🤔 👀 |
Hari Pachuveetil 📝 📖 |
Hsing-Hui Hsu 💻 📖 🤔 👀 |
Ikko Ashimine 📖 |
James 🐛 💻 |
James Kelley 🐛 |
James Mead 💻 |
- James Siri 💻 🚧 |
+ James Siri 💻 🚧 |
Jason Del Ponte 🤔 👀 |
Jason Fulghum 🤔 📆 👀 |
Jeff Malins 💻 |
Jerry Kindall 📖 🤔 |
Jimmy Gaussen 🤔 |
Johannes Weber 📖 |
- John Pantzlaff 💻 |
+ John Pantzlaff 💻 |
Jon Steinich 🐛 🤔 💻 |
Joseph Lawson 👀 |
Joseph Martin 🐛 |
Junix 🐛 |
Justin Frahm 🐛 |
Justin Taylor 🐛 |
- Kaizen Conroy 💻 🐛 |
+ Kaizen Conroy 💻 🐛 |
Kaizen Conroy 💻 |
Kaushik Borra 🐛 |
Knut O. Hellan 🐛 |
Kyle Thomson 💻 👀 |
Leandro Padua 🐛 |
Liang Zhou 🐛 💻 |
- Madeline Kusters 💻 🐛 |
+ Madeline Kusters 💻 🐛 |
Maja S Bratseth 🐛 |
Marcos Diez 🐛 |
Mark Nielsen 💻 |
Matthew Bonig 🐛 📝 |
Matthew Pirocchi 💻 🤔 👀 |
Meng Xin Zhu 🐛 |
- Michael Neil 🚧 |
+ Michael Neil 🚧 |
Mike Lane 🐛 |
Mitch Garnaat 🐛 💻 🤔 👀 |
Mitchell Valine 🐛 💻 🤔 🚧 👀 |
Mohamad Soufan 📖 |
Mykola Mogylenko 🐛 |
Naumel 👀 |
- Neta Nir 💻 🤔 🚧 👀 |
+ Neta Nir 💻 🤔 🚧 👀 |
Nick Lynch 🐛 💻 🚧 👀 |
Niranjan Jayakar 🐛 💻 🤔 🚧 👀 |
Noah Litov 💻 🚧 👀 |
Otavio Macedo 💻 🐛 |
PIDZ - Bart 🤔 |
Peter Woodworth 🚧 |
- Petr Kacer 🐛 |
+ Petr Kacer 🐛 |
Petra Barus 💻 |
Philip Cali 🤔 |
Quentin Loos 🤔 |
Raphael 🐛 |
Richard H Boyd 🐛 |
Rico Huijbers 🐛 💻 🤔 🚧 👀 |
- Romain Marcadier 🐛 💻 🎨 🤔 🚧 👀 📝 |
+ Romain Marcadier 🐛 💻 🎨 🤔 🚧 👀 📝 |
SADIK KUZU 👀 |
SK 🤔 |
Sam Fink 💻 👀 |
Sam Goodwin 👀 |
Sebastian Korfmann 🐛 💻 🤔 |
Sepehr Laal 🐛 |
- Shane Witbeck 🤔 |
+ Shane Witbeck 🤔 |
Shiv Lakshminarayan 💻 🚧 👀 |
Somaya 💻 🤔 🚧 👀 |
Stephen Kuenzli 📖 |
Takahiro Sugiura 📖 |
The Gitter Badger 💻 🚧 |
Thomas Poignant 🐛 |
- Thomas Steinbach 🐛 |
+ Thomas Steinbach 🐛 |
Thorsten Hoeger 💻 |
Tim Wagner 🐛 🤔 |
Tobias Lidskog 💻 |
Tom Bonner 🐛 |
Ty Coghlan 🐛 |
Tyler van Hensbergen 🤔 |
- Vlad Hrybok 🐛 |
+ Vlad Hrybok 🐛 |
Vladimir Shchur 🐛 |
Will Bender 🐛 |
Yan Zhulanow 💻 |
Yigong Liu 🐛 🤔 |
Zach Bienenfeld 🐛 |
ajnarang 🤔 |
- aniljava 💻 |
+ aniljava 💻 |
arnogeurts-sqills 🐛 💻 |
cn-cit 🐛 |
deccy-mcc 🐛 |
dependabot-preview[bot] 🐛 🚧 |
dependabot[bot] 🚧 |
dheffx 🐛 |
- gregswdl 🐛 |
+ gregswdl 🐛 |
guyroberts21 📖 |
mattBrzezinski 📖 |
mergify 🚧 |
mergify[bot] 🚧 |
nathannaveen 🚧 |
seiyashima42 🐛 💻 📖 |
- sullis 💻 |
+ sullis 💻 |
vaneek 🐛 |
wendysophie 🐛 |
diff --git a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go
index 935746192d..f437648f5c 100644
--- a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go
+++ b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go
@@ -16,6 +16,7 @@ import (
"github.com/aws/jsii-runtime-go/internal/embedded"
)
+const JSII_NODE string = "JSII_NODE"
const JSII_RUNTIME string = "JSII_RUNTIME"
type ErrorResponse struct {
@@ -104,7 +105,11 @@ func NewProcess(compatibleVersions string) (*Process, error) {
p.Close()
return nil, err
} else {
- p.cmd = exec.Command("node", entrypoint)
+ if node := os.Getenv(JSII_NODE); node != "" {
+ p.cmd = exec.Command(node, entrypoint)
+ } else {
+ p.cmd = exec.Command("node", entrypoint)
+ }
}
}
diff --git a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process_test.go b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process_test.go
index 0a38bed296..9bbcdfe155 100644
--- a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process_test.go
+++ b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process_test.go
@@ -101,6 +101,60 @@ func TestVersionCheck(t *testing.T) {
}
}
+func TestJSIINode(t *testing.T) {
+ t.Run("successful node invocation", func(t *testing.T) {
+ node, err := getNodePath()
+ if err != nil {
+ t.Fatal(err)
+ return
+ }
+
+ oldJsiiNode := os.Getenv(JSII_NODE)
+ os.Setenv(JSII_NODE, node)
+ defer os.Setenv(JSII_NODE, oldJsiiNode)
+
+ process, err := NewProcess("0.0.0")
+ if err != nil {
+ t.Fatal(err)
+ return
+ }
+ defer process.Close()
+
+ err = process.Request(TestRequest{"stats"}, &TestResponse{})
+ if err != nil {
+ t.Fatal(err)
+ return
+ }
+ })
+
+ t.Run("unsuccessful node invocation", func(t *testing.T) {
+ oldJsiiNode := os.Getenv(JSII_NODE)
+ os.Setenv(JSII_NODE, "./absolute-gibberish")
+ defer os.Setenv(JSII_NODE, oldJsiiNode)
+
+ process, err := NewProcess("0.0.0")
+ if err != nil {
+ t.Fatal(err)
+ return
+ }
+ defer process.Close()
+
+ if err := process.Request(TestRequest{"stats"}, &TestResponse{}); err == nil {
+ t.Errorf("expected an error, but no error received")
+ } else if !strings.Contains(err.Error(), "no such file or directory") && !strings.Contains(err.Error(), "file does not exist") {
+ // We have 2 options here because Windows returns a different error message, of course...
+ t.Errorf("expected 'no such file or directory' or 'file does not exist', got %v", err.Error())
+ }
+ })
+}
+
+type TestRequest struct {
+ Api string `json:"api"`
+}
+
+type TestResponse struct {
+}
+
type EchoRequest struct {
Message string `json:"message"`
}
@@ -110,6 +164,15 @@ type EchoResponse struct {
}
func makeCustomRuntime(mockVersion string) (string, error) {
+ node, err := getNodePath()
+ if err != nil {
+ return "", err
+ }
+
+ return fmt.Sprintf("%v %v %v", node, mockRuntime, mockVersion), nil
+}
+
+func getNodePath() (string, error) {
var (
node string
err error
@@ -119,8 +182,6 @@ func makeCustomRuntime(mockVersion string) (string, error) {
} else {
node, err = exec.LookPath("node")
}
- if err != nil {
- return "", err
- }
- return fmt.Sprintf("%v %v %v", node, mockRuntime, mockVersion), nil
+
+ return node, err
}