Comments (5)
Do you see the directory in Deno.env.get("PATH")
? Whatβs the extension of winget? Do you see that extension in Deno.env.get("PATHEXT")
?
from dax.
The directory does appear. The extension is exe
.
PS C:\> cmd /c where winget
C:\Users\user\AppData\Local\Microsoft\WindowsApps\winget.exe
PS C:\> which winget
/c/Users/user/AppData/Local/Microsoft/WindowsApps/winget
C:\Users\user\AppData\Local\Microsoft\WindowsApps
is on the path.
After inspecting the WindowsApps
directory, it appears winget.exe
is a symlink into another directory. This seems to be the common for applications installed by Windows Apps
(winget
is installed this way).
MINGW64 ~/AppData/Local/Microsoft/WindowsApps
$ ls -al
total 24
...
lrwxrwxrwx 1 user 197609 101 Mar 28 15:55 winget.exe -> '/c/Program Files/WindowsApps/Microsoft.DesktopAppInstaller_1.19.10173.0_x64__8wekyb3d8bbwe/winget.exe'*
lrwxrwxrwx 1 user 197609 93 Feb 15 10:37 wt.exe -> '/c/Program Files/WindowsApps/Microsoft.WindowsTerminal_1.16.10262.0_x64__8wekyb3d8bbwe/wt.exe'*
...
If I add the symlinked path directly to %PATH%
, it does work. The issue is maybe the symlink?
from dax.
Thanks for investigating! Yeah it appears deno_which needs to handle symlinks.
from dax.
Looks like updating deno_which
's fileExists
and fileExistsSync
functions to use Deno.lstat
resolves the issue.
Updated deno_which
mod.ts
:
async fileExists(path: string): Promise<boolean> {
try {
const result = await Deno.lstat(path);
return result.isFile;
} catch (err) {
if (err instanceof Deno.errors.PermissionDenied) {
throw err;
}
return false;
}
}
fileExistsSync(path: string): boolean {
try {
const result = Deno.lstatSync(path);
return result.isFile;
} catch (err) {
if (err instanceof Deno.errors.PermissionDenied) {
throw err;
}
return false;
}
}
The Deno docs state that Deno.stat
Will always follow symlinks but that does not appear to be the case. For example, this simple code errors:
try {
const stat = await Deno.stat(`C:/Users/user/AppData/Local/Microsoft/WindowsApps/winget.EXE`)
console.log(stat)
} catch (e) {
console.log(e)
}
Error: The file cannot be accessed by the system. (os error 1920): stat 'C:/Users/user/AppData/Local/Microsoft/WindowsApps/winget.EXE'
at async Object.stat (ext:deno_fs/30_fs.js:323:15)
at async file:///C:/Development/deno_which/test.ts:4:14
Is this a bug in Deno.stat
or weird issue with Windows symlinks?
from dax.
I investigated and opened denoland/deno#18598
This is not a deno_which issue.
from dax.
Related Issues (20)
- Merged streams make it unable to access streams HOT 1
- Panic on stderr redirect
- Make it easier to pipe to files HOT 3
- Patch for deprecation warnings in console/utils.ts HOT 2
- Redesign command and internal streams
- Ability to cancel a request HOT 1
- Support for subshells breaks escaped parentheses HOT 1
- Rename `PathRef` to `Path`
- Support providing a `CommandBuilder` to a template literal expr HOT 1
- built-in 'cat' command does not work with absolute paths
- Add `.linesIter()`
- Support glob expansion
- Path - Copy dir recursive
- Strict typing for arguments HOT 1
- Strange issue when upgrading Deno HOT 3
- $.prompt doesn't support utf-8? HOT 1
- add command for `tar` HOT 2
- imagemagick hangs π
- Windows style path is not treated as a valid command.
- Path - `lines()`/`linesSync()` and `.linesIter()`/`linesIterSync()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dax.