sindresorhus/opn
Do you want to work on this issue?
You can request for a bounty in order to promote it!
this seems to switch execution context on Windows to Powershell when using "cmd" #303
Pomax posted onGitHub
When using open, even if you run node
using cmd
instead of powershell, the open
function call changes the execution context to powershell, which is... not great? That should just stay cmd
.
This is most obvious with some straight foward STR.
- Create a file
test.js
and put the following code in it:import open from "open"; open("https://github.com"); await new Promise(resolve => setTimeout(resolve, 10000));
- run
cmd
and cd to the folder withtest.js
- run
node test.js
.
The cmd
title bar briefly changes to C:\Windows\System32\cmd.exe - node test.js
, then changes to Windows Powershell
. Something it really should not be doing. There aren't infinitely many windows-native command line interfaces, detecting that we're in cmd
and using that instead of using powershell would be pretty reasonable, given that the code looks like it's already checking whether it's in WSL or not.