Antyos / vscode-openscad

An OpenSCAD extension for VS Code
GNU General Public License v3.0
121 stars 17 forks source link

OpenSCAD launch is not working #62

Open snlitotes opened 7 months ago

snlitotes commented 7 months ago

Problem If I specify the launch path to e.g.: "openscad.launchPath": "d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe" then the launcher exits with an error message:

Cannot find the command: "d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe". Make sure OpenSCAD is installed. You may need to specify the installation path under `Settings > OpenSCAD > Launch Path`

Background To run OpenSCAD in a portable environment there is a wrapper executable needed that must have a different name from openscad.exe. So it is needed that the plugin-launcher is capable to run a launch path that can have an arbitrary name.

snlitotes commented 7 months ago

The reason might be that the OpenSCADportable wrapper forwards the command line parameters to openscad.exe but does not print any values to the console. So d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe --version would not produce any output. PortableApps.com is very common - so changing its launcher is not very likely.

Antyos commented 7 months ago

I've never heard of PortableApps before--I don't see OpenSCAD listed in their apps (https://portableapps.com/apps), where did you download it from? Not being able to forward command line output in a wrapper seems like a strange oversight. I wonder if it's a potential issue with the way it was generated.

Regardless, this may be a sign that I should create an "advanced" option to skip the version check. The previous way of checking the validity of the openscad exe was to check if the file itself existed, but this caused issues for use with Flatpak (#36). I don't really like "skip safety checks" as a principle, but I'm not sure how else to resolve this issue. Suggestions are welcome.

snlitotes commented 7 months ago

You see it not listed because nobody ported it to portableapps.com yet. This was my intent. My problem is that the portableapps launcher (based on NSIS) does not pass return values back to the console. I already had a hard to find out how to pass console messages back with NSIS. But the concept of it just did not forsee it. Skipping the version check would be an option. And I fully agree - just skipping safety checks is ugly. I would do that neither. If you like you can leave this issue open until somebody else comes with the same request or you just close it as not planned. Both is fine for me.

fenhl commented 5 months ago

I installed OpenSCAD using Scoop and I'm having the same issue — its shim for the openscad command also doesn't output anything when running openscad --version.

Antyos commented 5 months ago

I really wish these wrappers would respect command line output, but there's no point in complaining about something far beyond my control.

Maybe the solution should then be to check if the command runs successfully rather than listening for specific output. If there is no output to openscad --version, then it sets the version to undefined, but still continues as normal. In principle, I wanted to confirm the nature of the openscad executable before calling it with any real files, but perhaps that has caused more trouble than it's been worth.

I'll see what I can do about considering a valid executable to be one which can call openscad --version that doesn't write to stderr (such as calling a non-existent file).

fenhl commented 5 months ago

I have reported the missing version output as a bug to Scoop: https://github.com/ScoopInstaller/Extras/issues/13425

alok-mishra commented 1 month ago

I got openscad directly from https://files.openscad.org/OpenSCAD-2021.01-x86-64.zip from the link on this page: https://openscad.org/downloads.html (not the installer)

I put the path from the gui settings, and the json shows: "openscad.launchPath": "C:\\Apps\\openscad\\openscad.exe"

It still doesn't launch. I can see the version number when I type --version in the command line.

I tried both 64 and 32 bit versions.

Antyos commented 1 month ago

I got openscad directly from https://files.openscad.org/OpenSCAD-2021.01-x86-64.zip from the link on this page: https://openscad.org/downloads.html (not the installer)

I put the path from the gui settings, and the json shows: "openscad.launchPath": "C:\\Apps\\openscad\\openscad.exe"

It still doesn't launch. I can see the version number when I type --version in the command line.

I tried both 64 and 32 bit versions.

@alok-mishra I'm having trouble replicating your issue on my end, is this still an issue? Can you change your settings "openscad.logLevel": "DEBUG", then paste the contents of the OpenSCAD output channel here? (The command is openscad.showOutput if you have trouble finding it).

Also, I realize this issue has been open for way too long at this point considering the significant impact to usability, so I'm going to add a "skipLaunchPathValidation" setting for lack of a better option.

alok-mishra commented 1 month ago

@Antyos I set the logLevel to DEBUG, but not sure where I should see the output of it. In the Developer Tools, I do see the following error regardless of if that flag is set or not:

ERR Command failed: C:\Apps\openscad\openscad.exe --version
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what():  boost::filesystem::read_symlink: The request is not supported: "C:"
: Error: Command failed: C:\Apps\openscad\openscad.exe --version
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what():  boost::filesystem::read_symlink: The request is not supported: "C:"

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

console.ts:137 [Extension Host] rejected promise not handled within 1 second: Error: Command failed: C:\Apps\openscad\openscad.exe --version
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what():  boost::filesystem::read_symlink: The request is not supported: "C:"
 (at console.<anonymous> (file:///c:/Users/user/scoop/apps/vscode-insiders/1.94.0-1727327122221/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:10032))

openscad.exe isn't behind a symlink (although vscode-insiders is). And of course this is the zip version. If I do this in a terminal I get version info just fine.

C:\Apps\openscad>openscad --version
OpenSCAD version 2021.01

If you prefer (and not complicated), I can also try to look at the issue (and send a PR if able).

Antyos commented 1 month ago

@alok-mishra This looks to be an issue relating to symbolic links which is separate from the issue detailed here (which deals with the output of openscad --version not being properly received by the extension). I'm going to open another issue to discuss this.