Skip to content

Commit

Permalink
Remove usage of __dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
trappar committed Jan 31, 2024
1 parent a111a1c commit e049089
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6134,7 +6134,7 @@ async function main() {
(0,core.exportVariable)("TURBO_TOKEN", token);
(0,core.exportVariable)("TURBO_TEAM", teamId);
(0,core.debug)(`Starting Turbo Cache Server...`);
const subprocess = (0,external_child_process_namespaceObject.spawn)("node", [(0,external_path_.resolve)(__dirname, "../start_and_log")], {
const subprocess = (0,external_child_process_namespaceObject.spawn)("node", [(0,external_path_.resolve)(process.cwd(), "../start_and_log")], {
detached: true,
stdio: "ignore",
env: {
Expand Down
2 changes: 1 addition & 1 deletion dist/start_and_log/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const logDir = (0,external_path_namespaceObject.resolve)(external_os_default().t



const subprocess = (0,external_child_process_namespaceObject.spawn)("node", [(0,external_path_namespaceObject.resolve)(__dirname, "../server")]);
const subprocess = (0,external_child_process_namespaceObject.spawn)("node", [(0,external_path_namespaceObject.resolve)(process.cwd(), "../server")]);
subprocess.stdout.pipe((0,external_fs_namespaceObject.createWriteStream)((0,external_path_namespaceObject.resolve)(logDir, "out.log")));
subprocess.stderr.pipe((0,external_fs_namespaceObject.createWriteStream)((0,external_path_namespaceObject.resolve)(logDir, "err.log")));

24 changes: 14 additions & 10 deletions src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ async function main() {
exportVariable("TURBO_TEAM", teamId);

debug(`Starting Turbo Cache Server...`);
const subprocess = spawn("node", [resolve(__dirname, "../start_and_log")], {
detached: true,
stdio: "ignore",
env: {
...process.env,
PORT: port.toString(),
TURBO_TOKEN: token,
STORAGE_PROVIDER: storageProvider,
STORAGE_PATH: storagePath,
const subprocess = spawn(
"node",
[resolve(process.cwd(), "../start_and_log")],
{
detached: true,
stdio: "ignore",
env: {
...process.env,
PORT: port.toString(),
TURBO_TOKEN: token,
STORAGE_PROVIDER: storageProvider,
STORAGE_PATH: storagePath,
},
},
});
);

const pid = subprocess.pid?.toString();
subprocess.unref();
Expand Down
2 changes: 1 addition & 1 deletion src/start_and_log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createWriteStream } from "fs";
import { resolve } from "path";
import { logDir } from "./constants.js";

const subprocess = spawn("node", [resolve(__dirname, "../server")]);
const subprocess = spawn("node", [resolve(process.cwd(), "../server")]);

subprocess.stdout.pipe(createWriteStream(resolve(logDir, "out.log")));
subprocess.stderr.pipe(createWriteStream(resolve(logDir, "err.log")));

0 comments on commit e049089

Please sign in to comment.