opensouls / terminal-copilot

A smart terminal assistant that helps you find the right command.
Apache License 2.0
573 stars 43 forks source link

"open" command not found when running Ubuntu in WSL2 #18

Open alexiswl opened 1 year ago

alexiswl commented 1 year ago

To reproduce

> copilot split one list into two equally sized lists with a python oneliner
> explainshell: https://explainshell.com/explain?cmd=python%20-c%20%22print%28%5Bx%20for%20x%20in%20range%280%2C%20len%28input%28%29%29%2C%202%29%5D%29%22%20%7C%20xargs%20-n%202
Traceback (most recent call last):
  File "/usr/local/bin/copilot", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/copilot/copilot.py", line 99, in main
    subprocess.run(["open", "https://explainshell.com/explain?cmd=" + quote(cmd)])
  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'open'

I think open might be specifically a MacOS unix command.

I tried linking openvt to open but got the following openvt error

Couldn't get a file descriptor referring to the console

It does however work if I link xdg-open to open OR wslview to open so using that as a workaround for now.

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue