Repository navigation
Description
Using neuron open in WSL1 (Windows Subsystem for Linux) creates an error.
Not a dealmaker for me: I have been avoiding the command and use imperfect kludges.
(For users with this problem, see at bottom of this issue for one such kludge.)
However, this may be frustrating for other potential neutron users on WSL.
Thank, for the great tool! Aside from this, neuron within WSL works great!.
--jay
The Problem
Using 'neuron open' in WSL will create error messages similar to following.
Start : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
+ Start "/mnt/c/REALPATH/REMOVED/BY/ME/.neuron/output/index.html ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand "
Even though I was working in the bash shell of WSL, this error message is from Windows Powershell.
WSL bash seems to be passing execution to Windows Powershell.
I am using WSL1. (This is a Ubuntu distro, although I doubt this is relevant).
The error seems to be largely about passing a file path in the wrong format. (If unfamiliar, WSL uses Posix-style paths like /mnt/c/foobar to refer to windows paths like C:\foobar).
Towards a solution?
In doing some investigation to hack a solution, I wonder if the problem could be fixed near neuron/src/app/Neuron/CLI.hs line 67????
I suspect primary problem is xdg-open incorrectly passes off a posix-style WSL path to windows.
I lack the Haskell programming skills to be sure this is the problem or try to fix this, though.
Perhaps the logic should include checking if in windows subsystem for linux, then...
-
EITHER 1) gracefully give up with a warning this will not work in WSL with a hint at alternatives
-
or better, 2) transform the posix-style path to pass off a correct windows-style path.
-
since you may not use WSL, perhaps some of the following may have hints that could be helpful???
An imperfect current solution for WSL 1 users.
Try updating to the most recent release of WSL--perhaps this xdg-open issue is fixed there?
If not fixed, then, perhaps, use explorer.exe from WSL command line. This windows program can work if it does not have to worry about paths! To avoid paths, you may need to cd where neuron rib output is (i.e. if using defaults, ~/zettelkasten/.neuron/output).
To be more explicit...
EITHER...
cd ~/zettelkasten/.neuron/output # alter if using non-default directory
explorer.exe . # (note period!)
cd - # (to return to prior directory you were in)
OR replace second line with...
explorer.exe FILENAME
# (where FILENAME is index.html, search.html, etc)
The former will open the Windows explorer window and you can choose to open a file with its default program or
The latter will directly open the named file in a web browser, if an html mimetype.
You can recreate these commands in a script, of course. Though I actually just typed the following in once and then reverse-search (ctrl-r) for 'neuron open' when i need the line again.
cd ~/zettelkasten/.neuron/output && explorer.exe search.html && cd - # to replace 'neuron open'
This opens the file in my default web browser and NOT in windows explorer!
Activity
[-]Problem with neuron open on WSL (Windows Subsystem for Linux)[/-][+]neuron open (xdg-open) does not work on WSL[/+]jaysnoddy commentedon Jul 26, 2020
I forgot to add that I am using WSL 1. This might be relevant! I have edited this issue to reflect this.
xdg-open might be fixed or to be fixed soon in WSL2. If some Windows users do not have issue, this might explain it.
I updated with your latest , and still have this problem.
(via nix-env -if https://github.com/srid/neuron/archive/master.tar.gz)
(Given general update problems Microsoft is having, I--and others--have been holding off updating. sorry, I forgot I was not up-to-date with WSL. I will probably update WSL soon.)
srid commentedon Jul 26, 2020
FWIW, I have been using WSL 2 after switching to Windows yesterday. It is much faster than WSL (which I tried last some time ago). If you are interested in tweaking neuron (around CLI.hs where it invokes
xdg-open), you could use thebin/runscript on WSL 2's Ubuntu shell while making the code changes (in VS code); the script should give you live feedback on your changes. Then you just runnix-buildwhich will produce the new neuron under./result/binfor testing.But then, I suppose making
xdg-openwork seemlessly on WSL is probably the right approach. Then you don't need to change neuron at all.jaysnoddy commentedon Jul 27, 2020
srid commentedon Jul 27, 2020
@jaysnoddy We have a project chat area on both Zulip and Matrix; see links in README.
jaysnoddy commentedon Jul 28, 2020
srid commentedon Jul 28, 2020
Interesting; do let us know if you get to mention neuron in your textbook!
About the chat tags, that's a good observation-- I'll fix that.
Re-organize README