summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/background.ps1
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-06-03 20:00:35 +0000
committerStephen D. Huston <shuston@apache.org>2009-06-03 20:00:35 +0000
commitd7e2d5b8a2ebaa2188a294dd999bff8e27df15b6 (patch)
treedee1f1fe000c39cc72756ed81fc545cbca555976 /qpid/cpp/src/tests/background.ps1
parentcbd48a6a977974bc9a29b77f4fc4323b3558c6e1 (diff)
downloadqpid-python-d7e2d5b8a2ebaa2188a294dd999bff8e27df15b6.tar.gz
Initial capabilities to run test suite on Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@781525 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/background.ps1')
-rw-r--r--qpid/cpp/src/tests/background.ps136
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)