twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
994 stars 61 forks source link

[BUG] seemingly trying to use \ on linux instead of / when executing something in /tmp #345

Closed AkashicLibrary closed 1 month ago

AkashicLibrary commented 2 months ago

Describe the bug It seems that when trying to execute any language that needs to be compiled first (Python works because it doesn't need to compile from my knowledge) it is trying to access the compiled file like this /tmp(temp file number).(compiled file ending) which results in an EACCES Permission denied.

Software Version OS: Archcraft x86_64, Plugin Version: 1.11.1 Obsidian Version: 1.5.12-1 Edit: downloaded from the arch extra repo

To Reproduce Steps to reproduce the behavior:

  1. create a codeblock for any compiling language like rust or java (in my example I used java)
  2. specify run-(chosen language)
  3. write simple hello world the way it works with compiler normally
  4. press run
  5. see Error while executing /usr/bin/java -ea /tmp\temp_1714979553374.java: Error: EACCES: permission denied, open '/tmp\temp_1714979553374.java'

Expected behavior It should output hello world just like it does in python.

Screenshots error

Additional context if I'm just stupid and set it up wrong please inform me of it. Because I do not quite understand if this is a bug or if I did something wrong. Sorry for any grammatically wrong sentences, English isn't my first language

Update thanks to @He-Zu a fix was found. Thank you very much!

SanteIsHere commented 2 months ago

I am also encountering this issue.

He-Zu commented 2 months ago

make this change in main.js grafik to grafik then it works for me

apolzek commented 2 months ago

I am also encountering this issue.

RileyLeff commented 2 months ago

Thank you @He-Zu 🙏

bweinand commented 2 months ago

@He-Zu You made my day! Thank you 🙏

AkashicLibrary commented 2 months ago

@He-Zu Thank you this worked.

nfiles commented 2 months ago

Haha I didn't notice this issue until now. I submitted a PR that should fix the same problem against issue #347

twibiral commented 1 month ago

Fixed with new release version 1.12.0