Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute any code #331

Closed
DrunkenToast opened this issue Aug 8, 2024 · 11 comments · Fixed by #333
Closed

Unable to execute any code #331

DrunkenToast opened this issue Aug 8, 2024 · 11 comments · Fixed by #333

Comments

@DrunkenToast
Copy link
Contributor

Wanted to run a presentation on my work laptop (Apple M1 Max) and all snippets return error spawning process 'x': No such file or directory (os error 2) where x can be anything.

All the necessary utils are installed to execute (bash, node, rust etc) but none work.

This is a regression from my PR I believe, if I checkout the commit right before the CWD fix was introduced (#323), this wasn't an issue so it's related but don't immediately see why.

@DrunkenToast
Copy link
Contributor Author

DrunkenToast commented Aug 9, 2024

Cannot reproduce it anymore

@calebdw
Copy link
Contributor

calebdw commented Aug 9, 2024

Gotta love issues that fix themselves 🙃

@mfontanini
Copy link
Owner

Hmm I'll try later with a Mac. Not sure how it wouldn't work but if it didn't then something's wrong

@DrunkenToast
Copy link
Contributor Author

Hmm I'll try later with a Mac. Not sure how it wouldn't work but if it didn't then something's wrong

Not sure either, there doesn't seem anything wrong and I was definitely on latest & using the correct binary.
I might've ran it from a different/unexpected path though but I am not sure how I'd reproduce that.

@DrunkenToast
Copy link
Contributor Author

DrunkenToast commented Aug 10, 2024

Unrelated to MacOS.
I was able to reproduce it on linux using cargo install --path . to install it. I was doing this beforehand as well with no issues, am I using this incorrectly? Cargo run works as expected, release builds as well.
It is definitely building different binaries when checking out different commits.

image

@DrunkenToast DrunkenToast changed the title Unable to execute any code on MacOS Unable to execute any code Aug 10, 2024
@DrunkenToast DrunkenToast reopened this Aug 10, 2024
@mfontanini
Copy link
Owner

Are you invoking it the same way? e.g. is your pwd the same when you invoke it when it's globally installed or via ./target/release/presenterm?

@mfontanini
Copy link
Owner

This is very weird. Based on your screenshot what's failing is the invocation of node, as if you didn't have it installed/couldn't find it in $PATH (I presume you do have it installed and available right?). This is not that it can't find the snippet which is what your change did.

Related rust-lang/rust#37868 (comment). In that case that's about relative paths but this is not the case so I don't think it's what's happening here.

@DrunkenToast
Copy link
Contributor Author

DrunkenToast commented Aug 11, 2024

Are you invoking it the same way? e.g. is your pwd the same when you invoke it when it's globally installed or via ./target/release/presenterm?

I tried multiple different pwd's, with the release built all work fine (so running target/release). But with the global install it doesn't work from any pwd.

This is very weird. Based on your screenshot what's failing is the invocation of node, as if you didn't have it installed/couldn't find it in $PATH (I presume you do have it installed and available right?). This is not that it can't find the snippet which is what your change did.

Yeah, this is what I mentioned in my original post, I don't think my change is related either but when I checked out that commit it suddenly worked again.
Yesterday I checked out HEAD~20 and then the process just hanged on running, I assume the error occurred but it didn't show it. I don't think that it will be related to any changes I made anymore but is just an issue on its own. I don't really understand what causes it though.

@mfontanini
Copy link
Owner

Can you give #333 a shot? I don't have access to a macos machine right now but I have a hunch about why this is happening. I don't know why it happens depending on how you invoke the tool but given the issue wasn't there when the current_dir was absolute (because it was pointing to $tempdir directly), I imagine the issue is with current_dir being relative. That PR makes the resources path be an absolute path so if that's the case it should fix the issue.

Can you make sure you try:

  • Invoking the tool via relative path + via $PATH (e.g. ./target/debug/presenterm and presenterm)
  • Invoking it pointing to relative path to the presentation (e.g. presentation.md).
  • Invoking it pointing to relative path to the presentation but in another directory (e.g. presentations/presentation.md).
  • Invoking it pointing to an absolute path to the presentation (e.g. /tmp/presentation.md).

Thanks!

@DrunkenToast
Copy link
Contributor Author

I don't have access to a macos machine

It also happens on my linux desktop now, so just on unix it seems, though it seems extremely weird to me as I have developed it myself on linux and it worked fine, so really strange issue to me :)

Can you make sure you try:

  • Invoking the tool via relative path + via $PATH (e.g. ./target/debug/presenterm and presenterm)
    • Works
  • Invoking it pointing to relative path to the presentation (e.g. presentation.md).
    • Works
  • Invoking it pointing to relative path to the presentation but in another directory (e.g. presentations/presentation.md).
    • Works
  • Invoking it pointing to an absolute path to the presentation (e.g. /tmp/presentation.md).
    • Works
  • (Cargo run debug/release with relative path)
    • Works

Everything seems to work but then again, it used to before as well so I cannot say with confidence that it is fixed. :)
In fact, on MacOS the issue fixed itself the next day without me doing a thing and there it is still on latest with my changes.

I would say for now that it is fixed and I'll re-report it when it pops up again.

@mfontanini
Copy link
Owner

Thanks for checking! Let me know if it shows up again 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants