Redirect stderr/stdout to console on Windows launch. Add -q to quiet if desired.

Patch by jmckenzie; reviewed by pthompson for CASSANDRA-10641


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f8783b7b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f8783b7b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f8783b7b

Branch: refs/heads/cassandra-3.0
Commit: f8783b7bb1bd16d29565c3be86480a7188e91ee0
Parents: cb42906
Author: Joshua McKenzie <jmcken...@apache.org>
Authored: Fri Nov 6 13:42:14 2015 -0500
Committer: Joshua McKenzie <jmcken...@apache.org>
Committed: Fri Nov 6 13:42:14 2015 -0500

----------------------------------------------------------------------
 bin/cassandra.ps1 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8783b7b/bin/cassandra.ps1
----------------------------------------------------------------------
diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1
index 44ba9a4..25b701b 100644
--- a/bin/cassandra.ps1
+++ b/bin/cassandra.ps1
@@ -17,7 +17,7 @@
 Function PrintUsage
 {
     echo @"
-usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-D arg] [-E 
errorfile] [-install | -uninstall] [-help]
+usage: cassandra.ps1 [-f] [-h] [-q] [-a] [-p pidfile] [-H dumpfile] [-D arg] 
[-E errorfile] [-install | -uninstall] [-help]
     -f              Run cassandra in foreground
     -install        install cassandra as a service
     -uninstall      remove cassandra service
@@ -28,6 +28,7 @@ usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-D 
arg] [-E errorfile
     -v              Print cassandra version and exit
     -s              Show detailed jvm environment information during launch
     -a              Aggressive startup. Skip VerifyPorts check. For use in dev 
environments.
+    -q              Quiet output. Does not print stdout/stderr to console 
(when run without -f)
     -help           print this message
 
     NOTE: installing cassandra as a service requires Commons Daemon Service 
Runner
@@ -253,7 +254,14 @@ $env:JAVA_BIN
     }
     else
     {
-        $proc = Start-Process -FilePath "$cmd" -ArgumentList 
$arg1,$arg2,$arg3,$arg4 -PassThru -WindowStyle Hidden
+        if ($q)
+        {
+            $proc = Start-Process -FilePath "$cmd" -ArgumentList 
$arg1,$arg2,$arg3,$arg4 -PassThru -WindowStyle Hidden
+        }
+        else
+        {
+            $proc = Start-Process -FilePath "$cmd" -ArgumentList 
$arg1,$arg2,$arg3,$arg4 -PassThru -NoNewWindow
+        }
 
         $exitCode = $?
 
@@ -366,6 +374,7 @@ for ($i = 0; $i -lt $args.count; $i++)
         "-H"                { $H = $args[++$i]; CheckEmptyParam($H) }
         "-E"                { $E = $args[++$i]; CheckEmptyParam($E) }
         "-a"                { $a = $True }
+        "-q"                { $q = $True }
         default
         {
             "Invalid argument: " + $args[$i];

Reply via email to