This library allows running PowerShell scripts in Windows Sandbox.
git submodule add https://github.com/tomashubelbauer/node-wsb
To update:
cd node-wsb
git pull
cd ..
import wsb from './node-wsb/index.js';
console.log(await wsb('echo "Hello, World!"'));
The return value is an object:
stdout
(string
): the output value in case of successstderr
(string
): the output value in case of failureexitCode
(number
): 0 for success, 1 for failuretranscript
(object
):startTime
(string
): the transcript start instant inyyyymmddhhmmss
endTime
(string
): the transcript end instant inyyyymmddhhmmss
meta
(object
): an object made of transcript metadata key-value pairsdata
: (string[]
) an array of lines written to the transcript
Run tests using npm test
.
Use todo
.
This would be used in the CI or when the user doesn't want to / can't enable WSB on their machine.
Perhaps it should be a separate package though.
I think we could find the sandbox' IP address and connect to it using PowerShell remoting and run the commands that way. We might need to turn it on first.