mosh
mosh copied to clipboard
win32: Consider how `isExecutable` treated
I'm going to temporarily comment-out Win32 isExecutable
implementation since it doesn't compile on the latest source.
https://github.com/higepon/mosh/blob/935355556adfec7fcacc0f478132c72a352097bb/src/OSCompat.cpp#L680-L688
(Since ucs4string
is now explicit
, we cannot instantiate them in this way.)
Win32 do not have "executable" bit on its filesystem so ultimately we cannot implement this. We can consider multiple implementations and need to choose one:
-
a) Decide on file extension (Previous implementation)
- consider "double-click-to-execute" files as executable.
- Previous implementation is incomplete; use
PATHEXT
to get precise result - Pros:
- ????
- Cons:
- Even if
isExecutable
true, Win32 APICreateProcess
might not accept it
- Even if
-
b) Always
false
(My preference)- Same as Git -- On (Native-)Windows, it always consider file is not executable
- Pros:
- Reflects filesystem attributes precisely -- Windows' filesystem do not have one
- Cons:
- Even
.exe
evaluated asfalse
- Even
-
c) Always
true
- Same as Cygwin -- On Cygwin, any files on foreign filesystem is treated as Executable
What's the use case for an isExecutable
procedure?
(I once tried writing a procedure to get the filename of the running executable, and faced similar difficulties. The solution was to remove the whole procedure :-)
What's the use case for an isExecutable procedure?
Mosh(-scheme) has been originally developed to implement Scheme-shell -- if we wanted to implement TAB completion for a command line, we'd need one to pick-up executable from PATH
.
On Windows, I think it's for completeness; world's being dominated by POSIX. Even WASI -- which is intended to be write-once-run-anywhere -- have executable bit for now.