Reproduction steps:
cd /tmp
git clone https://github.com/Microsoft/TypeScript.git
cd TypeScript
npm install nar
./node_modules/nar/bin/nar create --executable
mv *.nar /tmp/typescript.nar
cd /tmp
chmod +x typescript.nar
echo "var x = function() {alert('test');}" > /tmp/test.ts
You now have everything the way I would expect it
# This will fail
cd /tmp
/tmp/typescript.nar exec --out test.js test.ts
# This will succeed
cd /tmp
/tmp/typescript.nar exec --out /tmp/test.js /tmp/test.ts
Do you have any ideas on why the cwd is being changed by nar? Is that what it should be doing?