[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser-bundle/master] Send all output to /dev/null and disown, unless using --debug.



commit f9c0f074b2a29087f8bcc9b3072902d093d28fac
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Wed Mar 18 08:16:10 2015 +0000

    Send all output to /dev/null and disown, unless using --debug.
    
    If the start-tor-browser script is called normally, this will send all
    output to /dev/null and disown the firefox process.
    
    If --debug is passed to the start-tor-browser script, then output will
    go to the terminal it was called from, as well as the logfile,
    'tor-browser-debug.log', in the top level of Tor Browser's $HOME
    directory.  In this case, we don't disown the child firefox process, and
    we also pass the -jsconsole parameter to firefox.
    
     * FIXES part of #13375: https://bugs.torproject.org/13375
---
 RelativeLink/start-tor-browser |   37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/RelativeLink/start-tor-browser b/RelativeLink/start-tor-browser
index 071c80d..d28c759 100755
--- a/RelativeLink/start-tor-browser
+++ b/RelativeLink/start-tor-browser
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # GNU/Linux does not really require something like RelativeLink.c
 # However, we do want to have the same look and feel with similar features.
@@ -302,22 +302,27 @@ EOF
 # your password in the following line where the word â??secretâ?? is:
 setControlPortPasswd ${TOR_CONTROL_PASSWD:='"secret"'}
 
-# XXX: Debug mode for Firefox??
-
-# not in debug mode, run proceed normally
 printf "Launching Tor Browser for Linux in ${HOME}...\n"
 cd "${HOME}"
-# XXX Someday we should pass whatever command-line arguments we got
-# (probably filenames or URLs) to Firefox.
-# !!! Dash above comment! Now we pass command-line arguments we got (except --debug) to Firefox.
-# !!! Use at your own risk!
-# Adding --class for fixing bug 11102.
-TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox  --class "Tor Browser" \
-    -profile TorBrowser/Data/Browser/profile.default "${@}"
-exitcode="$?"
-if [ "$exitcode" -ne 0 ]; then
-	complain "Tor Browser exited abnormally.  Exit code: $exitcode"
-	exit "$exitcode"
+
+# We pass all command-line arguments we got (except --debug) to Firefox.  Use
+# at your own risk!
+#
+# The --class parameter was added to fix bug 11102.
+#
+# When passed the --debug option, we log all the output that goes to the
+# parent terminal stdout and stderr to a file ('tor-browser-debug.log' in Tor
+# Browser's $HOME directory).
+if [ "$debug" -ne 1 ] ; then
+    TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
+        -profile TorBrowser/Data/Browser/profile.default "${@}" > /dev/null 2>&1 </dev/null &
+    disown "$!"
 else
-	printf '\nTor Browser exited cleanly.\n'
+    logfile=$(dirname ${HOME} )/tor-browser-debug.log
+    printf "Logging Tor Browser debug information to file: %s\n" "$logfile"
+    TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
+        -profile TorBrowser/Data/Browser/profile.default "${@}" -jsconsole 2>&1 </dev/null | \
+        tee $logfile
 fi
+
+exit $?



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits