Skip to content

Commit

Permalink
fix(ngrok): invalid relative path to ngrok.js (#79)
Browse files Browse the repository at this point in the history
Gathers the dirname during preflight so it can spawn the `ngrok.js` helper during inflight.
  • Loading branch information
skyrpex authored Feb 15, 2024
1 parent 7fae037 commit e0dbf01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ngrok/ngrok.w
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ pub class Tunnel {
throw "NGROK_AUTHTOKEN is not defined";
}

let dirname = Tunnel.dirname();
let s = new cloud.Service(inflight () => {
try {
let child = Tunnel.spawn("node", Array<str?>["./ngrok.js", url, props?.domain]);
let child = Tunnel.spawn("node", Array<str?>["{dirname}/ngrok.js", url, props?.domain]);
log("ngrok: {child.url()} => {url}");
let url = child.url();
this.state.set("url", url);
Expand Down Expand Up @@ -63,4 +64,7 @@ pub class Tunnel {

extern "./util.js"
static inflight spawn(cmd: str, args: Array<str?>, opts: Json?): ChildProcess;

extern "./util.js"
static dirname(): str;
}
2 changes: 2 additions & 0 deletions ngrok/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { spawn } = require("child_process");

exports.dirname = () => __dirname;

exports.spawn = async (cmd, args, opts) => {
const child = spawn(cmd, args, { stdio: "pipe", ...opts });
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit e0dbf01

Please sign in to comment.