mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-04-11 22:30:58 +01:00
fix(lib): decompression on windows
* Decompression on windows failed since the `Start-Process` cmdlet exited immediately after spawning the process. Fixed by including the `-Wait` argument. * We were using `unzip` on all platforms, and it does not exist on Windows. Instead, now we use the `Expand-Archive` cmdlet for decompression on windows.
This commit is contained in:
parent
50811ad970
commit
3a65776a3c
2 changed files with 8 additions and 4 deletions
|
@ -58,9 +58,13 @@ local decompress: { [CompressionFormat]: (compressed: buffer) -> Result<pathfs.A
|
||||||
pathfs.writeDir(decompressedDir)
|
pathfs.writeDir(decompressedDir)
|
||||||
|
|
||||||
-- Run unzip to decompress the file
|
-- Run unzip to decompress the file
|
||||||
local child = CommandBuilder
|
local child = (if process.os == "windows"
|
||||||
.new("unzip")
|
-- Thanks windows :)
|
||||||
:withArgs({ tmpFilePath, "-d", decompressedDir:toString() })
|
then CommandBuilder.new("powershell"):withArgs({
|
||||||
|
"-ExecutionPolicy RemoteSigned",
|
||||||
|
`-c \`"Import-Module Microsoft.PowerShell.Archive; Expand-Archive -LiteralPath '{tmpFilePath}' -DestinationPath '{decompressedDir:toString()}'\`"`,
|
||||||
|
})
|
||||||
|
else CommandBuilder.new("unzip"):withArgs({ tmpFilePath, "-d", decompressedDir:toString() }))
|
||||||
-- FIXME: remove unknown usage
|
-- FIXME: remove unknown usage
|
||||||
:withStdioStrategy({
|
:withStdioStrategy({
|
||||||
stdout = Option.Some("pipe" :: CommandBuilder.StdioStrategy) :: Option<unknown>,
|
stdout = Option.Some("pipe" :: CommandBuilder.StdioStrategy) :: Option<unknown>,
|
||||||
|
|
|
@ -120,7 +120,7 @@ function CommandBuilder.intoChildProcess(self: CommandBuilder): ChildProcess
|
||||||
for _ = 0, retries do
|
for _ = 0, retries do
|
||||||
local spawned = process.spawn(
|
local spawned = process.spawn(
|
||||||
if process.os == "windows"
|
if process.os == "windows"
|
||||||
then `(Start-Process {self.program} -Passthru -NoNewWindow -ArgumentList \"{argsList}\").Id`
|
then `(Start-Process {self.program} -Passthru -Wait -ExecutionPolicy Bypass -NoNewWindow -ArgumentList \"{argsList}\").Id`
|
||||||
else `{self.program} {argsList} & echo $!`,
|
else `{self.program} {argsList} & echo $!`,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue