From fb4377242992201f8891a0a83e1c391f8cfee6c0 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 17 Jun 2014 15:44:06 -0500 Subject: [PATCH] Instantiate psobject directly --- windows/assemble.ps1 | 2 +- windows/async_wrapper.ps1 | 2 +- windows/command.ps1 | 2 +- windows/copy.ps1 | 2 +- windows/file.ps1 | 2 +- windows/ping.ps1 | 2 +- windows/slurp.ps1 | 4 ++-- windows/stat.ps1 | 6 +++--- windows/win_ping | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/windows/assemble.ps1 b/windows/assemble.ps1 index 77385b56100..dc95d1b9f53 100644 --- a/windows/assemble.ps1 +++ b/windows/assemble.ps1 @@ -8,6 +8,6 @@ If ($args.Length -gt 0) $data = 'FIXME'; -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/async_wrapper.ps1 b/windows/async_wrapper.ps1 index 77385b56100..dc95d1b9f53 100644 --- a/windows/async_wrapper.ps1 +++ b/windows/async_wrapper.ps1 @@ -8,6 +8,6 @@ If ($args.Length -gt 0) $data = 'FIXME'; -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/command.ps1 b/windows/command.ps1 index 77385b56100..dc95d1b9f53 100644 --- a/windows/command.ps1 +++ b/windows/command.ps1 @@ -8,6 +8,6 @@ If ($args.Length -gt 0) $data = 'FIXME'; -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/copy.ps1 b/windows/copy.ps1 index 77385b56100..dc95d1b9f53 100644 --- a/windows/copy.ps1 +++ b/windows/copy.ps1 @@ -8,6 +8,6 @@ If ($args.Length -gt 0) $data = 'FIXME'; -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/file.ps1 b/windows/file.ps1 index 77385b56100..dc95d1b9f53 100644 --- a/windows/file.ps1 +++ b/windows/file.ps1 @@ -8,6 +8,6 @@ If ($args.Length -gt 0) $data = 'FIXME'; -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/ping.ps1 b/windows/ping.ps1 index 02560873f5d..ee46cfd4b86 100644 --- a/windows/ping.ps1 +++ b/windows/ping.ps1 @@ -12,6 +12,6 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data' $data = $params.data; } -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name ping -Value $data; echo $result | ConvertTo-Json; diff --git a/windows/slurp.ps1 b/windows/slurp.ps1 index 93a698491fc..21e912f46ae 100644 --- a/windows/slurp.ps1 +++ b/windows/slurp.ps1 @@ -1,7 +1,7 @@ #!powershell # WANT_JSON -$params = '{}' | ConvertFrom-Json; +$params = New-Object psobject; If ($args.Length -gt 0) { $params = Get-Content $args[0] | ConvertFrom-Json; @@ -27,7 +27,7 @@ If (-not $src) $bytes = [System.IO.File]::ReadAllBytes($src); $content = [System.Convert]::ToBase64String($bytes); -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name content -Value $content; $result | Add-Member -MemberType NoteProperty -Name encoding -Value 'base64'; echo $result | ConvertTo-Json; diff --git a/windows/stat.ps1 b/windows/stat.ps1 index f779b2531e3..2e87b12275a 100644 --- a/windows/stat.ps1 +++ b/windows/stat.ps1 @@ -1,7 +1,7 @@ #!powershell # WANT_JSON -$params = '{}' | ConvertFrom-Json; +$params = New-Object psobject; If ($args.Length -gt 0) { $params = Get-Content $args[0] | ConvertFrom-Json; @@ -19,7 +19,7 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'get_m $get_md5 = $params.get_md5; } -$stat = '{}' | ConvertFrom-Json; +$stat = New-Object psobject; If (Test-Path $path) { $stat | Add-Member -MemberType NoteProperty -Name exists -Value $TRUE; @@ -45,7 +45,7 @@ If ($get_md5 -and $stat.exists -and -not $stat.isdir) $stat | Add-Member -MemberType NoteProperty -Name md5 -Value $path_md5; } -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name stat -Value $stat; $result | Add-Member -MemberType NoteProperty -Name changed -Value $FALSE; echo $result | ConvertTo-Json; diff --git a/windows/win_ping b/windows/win_ping index f64134454db..8eba171d0ea 100644 --- a/windows/win_ping +++ b/windows/win_ping @@ -12,7 +12,7 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data' $data = $params.data; } -$result = '{}' | ConvertFrom-Json; +$result = New-Object psobject; $result | Add-Member -MemberType NoteProperty -Name ping -Value $data; echo $result | ConvertTo-Json;