-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
powershell scripts for installed binaries #20
Conversation
accepted/0000-powershell-bins.md
Outdated
```powershell | ||
$myPath = Split-Path $myInvocation.MyCommand.Path -Parent | ||
$node = Join-Path $myPath "node.exe" | ||
$binPath = Join-Path $myPath "[ path to node_module bin script, e.g. node_modules\typescript\bin\tsc]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a generated script, this should use single quotes.
@bterson nice job. You can also add that MS (or atleast some of their top employees) itself recommends we use ps1 scripts. See microsoft/terminal#217 (comment) |
Here's an example of a functionally identical powershell wrapper: | ||
|
||
```powershell | ||
$myPath = Split-Path $myInvocation.MyCommand.Path -Parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a difference between this and $PSScriptRoot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joeyaiello! So IMO it's probably better to err on the side of caution and go with the more compatible $myInvocation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a concrete response to #20 (comment) and https://twitter.com/paulcbetts/status/1031669429111640064 before ratifying this RFC. I'm otherwise 👍 so once that's tested and confirmed and we have understand what the behavior should be (and whether it might cause any big problems), we'll probably just ratify this. :)
This RFC is at a stage where it's probably fine to put together a PR for cmd-shim
to make sure nothing surprising happens.
Roger that, thanks @zkat! I plan to test with a fresh install of Windows. FWIW, I believe it's going to work because scripts created from a local process (i.e. node.exe) should be considered local scripts rather than remote scripts. I'm unfortunately headed out for vacation as we speak, so if someone is super amped about this and wants to test this, I'd be happy! Otherwise, I'll be back in September. |
However the more reliable way should be, like, emitting an EXE? |
@bterlson
... and I saw these
These are WSH's batch files and runs blocks of VBScript/JScript (the very old version, stopped at ES3...), and it existed in Windows for over 20 years. I think they could be a very interesting solution for this particular problem. |
😂 Using such an ancient tech which very few people even remember how to program might be counter-productive to our goals here, no? Btw, there is |
@kumarharsh But, isn't CMD more ancient? |
Yeah, but the issue is about migrating from CMD to something more modern... migrating to JScript would not be ideal IMO |
@kumarharsh |
The technique sound great, apart from the virus caveat. Does Windows Defender catch these types of modifications to an EXE? |
@kumarharsh Not tried. Maybe I can try them in the incoming holiday (Oct 1-7). |
IMHO the Windows antivirus world is still a disaster, and should absolutely preclude any notion of shipping a |
@dahlbyk But if the emitted EXE is digitally signed, the situation could be different. |
Hey @bterlson! I assume you're going on another vacation very soon (lol), but when you're able, can you get around to test the open questions so we can get a better idea about what we'll be dealing with in re execpolicy and how it should be addressed? |
Is it safe to move this to "implemented" since cmd-shim landed npm/cmd-shim#34 in [email protected], which is set for release in npm 6.11.0? |
Let's get rid of "Terminate batch job (Y/N)" for Windows users using powershell!