diff --git a/bin/env.ts b/bin/env.ts index d921cef..8dd70f5 100644 --- a/bin/env.ts +++ b/bin/env.ts @@ -1,7 +1,13 @@ const execSync = require('child_process').execSync // Change to the directory of this file -process.chdir(process.env.PWD) +if (process.cwd()) { + process.chdir(process.cwd()); +} else { + console.error('Current working directory is undefined'); + process.exit(1); +} + // Get the path to the head of the `Subgraphs` repo export const MESSARI_REPO_PATH = execSync('git rev-parse --show-toplevel')