Closed dblohm7 closed 2 years ago
@dblohm7 I'd love advice on how to use the shell to query for it's location. I spent an hour and a bit last week trying to parse through online guides to Powershell but didn't find anything useful.
What commands would you use to query for the location of tailscale.exe?
@rosszurowski Using cmd
I'd use where
(it's basically identical to which
).
I'm less familiar with PowerShell, but this looks like it's producing what we're looking for:
Get-Command tailscale | Format-Wide -Property Source
Perfect, thanks! I'll be running this from Docker's execHostCmd
function, so I'll have to see whether that supports cmd or powershell. I'll give both of these a try.
Hmm… I can't get the PowerShell command to work in the terminal
Same with the cmd command
Can you check your PATH?
echo %PATH%
in cmd
, or $Env:PATH
in PowerShell
Result of echo %PATH%
:
C:\Program Files\Parallels\Parallels Tools\Applications;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Tailscale IPN;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\rosszurowski\AppData\Local\Microsoft\WindowsApps;
Result of $Env:PATH
:
C:\Program Files\Parallels\Parallels Tools\Applications;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Tailscale IPN;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\rosszurowski\AppData\Local\Microsoft\WindowsApps
I may be running an odd environment since it's Windows 11 on ARM, emulated through Parallels (https://github.com/tailscale/corp/issues/3550). If you're confident one of those lines will work for most users, I'll just defer to that.
Oh, I know exactly what your problem is!
So Win11 on ARM our path should be in C:\Program Files (x86)
, but that is a known bug in our installation code when using NSIS. So we need to get that fixed in the client. But as far as the plugin is concerned, resolving it using the above technique should be okay.
Sounds good. I looked at the Node docs and it seems like the default shell is cmd.exe
. So where tailscale.exe
it is!
Example output to parse:
> child_process.exec("where cmd.exe", (err, stdout, stderr) => console.log(err, stdout, stderr))
null C:\Windows\System32\cmd.exe
> child_process.exec("where tailscale.exe", (err, stdout, stderr) => console.log(err, stdout, stderr))
Error: Command failed: where tailscale.exe
INFO: Could not find files for the given pattern(s).
at ChildProcess.exithandler (node:child_process:399:12)
at ChildProcess.emit (node:events:520:28)
at ChildProcess.emit (node:domain:537:15)
at maybeClose (node:internal/child_process:1090:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:520:28)
at Socket.emit (node:domain:537:15)
at Pipe.<anonymous> (node:net:687:12)
at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {
killed: false,
code: 1,
signal: null,
cmd: 'where tailscale.exe'
} INFO: Could not find files for the given pattern(s).
TL;DR Our installer allows Tailscale to be installed somewhere other than
C:\Program Files
. Since we add it to thePATH
, maybe using the shell to query for its location might be better?CC @rosszurowski