mfontanini / presenterm

A markdown terminal slideshow tool
https://mfontanini.github.io/presenterm/
BSD 2-Clause "Simplified" License
1.33k stars 32 forks source link

Running code from CWD #322

Closed DrunkenToast closed 3 months ago

DrunkenToast commented 3 months ago

Currently code is ran from the /tmp directory, however this leads to unexpected results.

For instance a repository with slides might run scripts from that repository, however it will not be able to relatively refer to those scripts and will need to define the paths absolutely.

Now the problem arises when another person wants to run these slides, since the absolute paths would be incorrect.

I am not sure if this would cause any security issues, the slides are still explicit about what they do, they now just behave like any other executable and run from with the context of that cwd where the presentation was started.

Reasons why we would want this:

Not sure why we wouldn't want this but open to discuss.


pwd

cd ~/slides presenterm +x slides.md

Expected behaviour: /home/<user>/slides

Current behaviour: /tmp/<hash>

calebdw commented 3 months ago

You beat me to opening this!

DrunkenToast commented 3 months ago

You beat me to opening this!

Yes! I won the race! :rocket: I have implemented something quickly in #323, so you can check that out if you'd like!

mfontanini commented 3 months ago

Nice, thanks!

glfharris commented 2 days ago

Just to add that this fix doesn't seem to apply for the python path & imports. Have to do something like the following for `/path/to/folder/local_module':

import sys
sys.path.insert(0, '/path/to/folder/')
import local_module