diff options
Diffstat (limited to 'qpid/cpp/src/tests/background.ps1')
| -rw-r--r-- | qpid/cpp/src/tests/background.ps1 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/background.ps1 b/qpid/cpp/src/tests/background.ps1 new file mode 100644 index 0000000000..096379860a --- /dev/null +++ b/qpid/cpp/src/tests/background.ps1 @@ -0,0 +1,36 @@ +# From http://ps1.soapyfrog.com/2007/01/22/running-pipelines-in-the-background/
+# Copyright © 2006-2009 Adrian Milliner
+param(
+ [scriptblock] $script, # scriptblock to run
+ [switch] $inconsole # don't create a new window
+)
+
+# break out of the script on any errors
+trap { break }
+
+# encode the script to pass to the child process...
+$encodedString = [convert]::ToBase64String(
+ [Text.Encoding]::Unicode.GetBytes([string] $script))
+
+# create a new process
+$p = new-object System.Diagnostics.Process
+
+# create a startinfo object for the process
+$si = new-object System.Diagnostics.ProcessStartInfo
+$si.WorkingDirectory = $pwd
+
+if ($inconsole)
+{
+ $si.UseShellExecute = $false
+}
+Else
+{
+ $si.UseShellExecute = $true
+}
+
+# set up the command and arguments to run
+$si.FileName = (get-command powershell.exe).Definition
+$si.Arguments = "-encodedCommand $encodedString"
+
+# and start the powershell process
+[diagnostics.process]::Start($si)
|
