Open jay-ramani opened 1 week ago
Hi, thanks for reporting this! Is it hanging indefinitely? i.e. still blocked after waiting for, say, 2 minutes? or is this "just" trying to auto-complete on a very slow filesystem? (this is a real problem, that I am currently trying to address by adding a timeout to the auto-completion)
Hi, thanks for the quick response. Yes, seems to "hang" indefinitely. I have network shares on a Synology DS920+ mounted as drives, and regardless of the mount, the auto-completion seems blocked. The NAS is otherwise accessible from a regular Windows native command line; works instantly, and perfectly fine even with auto-completion. Try it yourself on any network share mounted with PyCmd.
I didn't check the code, but in the worst case, do you want to timeout in case you're doing a blocked wait?
I am using network shares (mounted as drives) with PyCmd without getting into hangs -- but typing can be annoying sometimes due to laggy auto-suggest and/or completion. I'm not sure what is different in your case; here are some questions that might give us some clues (if you can spare some time):
dir X:\somedir
)?os.chdir('X:\somedir')
, then try to do a pathlib.Path().glob('*')
?The timeout feature would help with the typing hiccups that I mentioned above; it could also get over the hangs you are seeing -- but then I would expect that the next thing breaks (completing with Tab, running a command, detecting the current directory etc.)
I would be very happy to help to have this resolved.
- did this ever work for you to use PyCmd with network shares? (e.g. a long while ago, with some old version of PyCmd and/or Windows)?
No
- what happens if you start PyCmd in a regular folder, then try to type some command that includes a path under X: (say, dir X:\somedir)?
Tries to auto-complete (as in, shows the directory on auto-completion with tab) and hangs. If I don't use auto-completion, as in, directly type a path under the network mounted share, say X:\English, PyCmd works fine. So the issue seems to do with auto-completion.
- what happens if you start cmd.exe, cd to X:\somedir, then start PyCmd.exe straight from the command prompt?
Works, as long as it does not try to auto-complete
- what happens if you start some python3 interpreter, then os.chdir('X:\somedir'), then try to do a pathlib.Path().glob('*')?
No hangs, but does not list the directories or files within. Log below:
>python --version
Python 3.12.6
>python
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import pathlib
>>> os.chdir('M:\\')
>>> os.getcwd()
'M:\\'
>>> pathlib.Path().glob('*')
<generator object Path.glob at 0x000001FA62D09470>
I would be very happy to help to have this resolved.
Appreciated!
Works, as long as it does not try to auto-complete
This is already interesting (read: surprising) -- normally, while you type the auto-suggestion mechanism kicks-in and tries to suggest a continuation to the typed text based on the file listing (using the same mechanism that the Tab-completion uses).
No hangs, but does not list the directories or files within. Log below:
My bad, sorry for being sloppy: glob()
returns a generator object so in order to actually iterate over the files you need to execute list(pathlib.Path().glob('*'))
.
While you are at it, please also try os.listdir()
after os.chdir()
in the M:\\
directory, and maybe also os.listdir('M:\\')
after chdir('C:\\somewhere')
This is already interesting (read: surprising) -- normally, while you type the auto-suggestion mechanism kicks-in and tries to suggest a continuation to the typed text based on the file listing (using the same mechanism that the Tab-completion uses).
Yup, hangs when the auto-suggestion kicks in
No hangs, but does not list the directories or files within. Log below:
My bad, sorry for being sloppy:
glob()
returns a generator object so in order to actually iterate over the files you need to executelist(pathlib.Path().glob('*'))
. While you are at it, please also tryos.listdir()
afteros.chdir()
in theM:\\
directory, and maybe alsoos.listdir('M:\\')
afterchdir('C:\\somewhere')
Both list(pathlib.Path().glob('*'))
and os.listdir('M:\\')
list the entries fine
Mount any network share and either paste a path on it, or try auto-completing. The console instantly hangs!
PyCmd version: 20240904-x64 (happening on at least four versions prior as well, not sure about ones older) OS version: Windows 11 23H2 build 22631.4317