author Sebastian Hengst <>
Thu, 29 Jun 2017 01:02:26 +0200
changeset 366673 ed5cc84d317f8c1148eed57f69fd1f91e0eb4cac
parent 316298 22d95521160beb0c26e6dcee7c979e0cb617bb56
permissions -rw-r--r--
Backed out changeset d95016c5fc99 (bug 1351608) because eslint can't find the new plugin "eslint-plugin-no-unsanitized". r=backout

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

import expandlibs_exec
import sys
import threading
import time

def periodically_print_status(proc):
    Print something to the console every 20 minutes to prevent the build job
    from getting killed when linking a large binary.
    Check status of the linker every 0.5 seconds.
    idleTime = 0
    while proc.returncode is None:
        idleTime += 0.5
        if idleTime > 20 * 60:
          print "Still linking, 20 minutes passed..."
          idleTime = 0

def wrap_linker(args):
    Execute |args| and pass resulting |proc| object to a second thread that
    will track the status of the started |proc|.

    # This needs to be a list in order for the callback to set the
    # variable properly with python-2's scoping rules.
    t = [None]
    def callback(proc):
        t[0] = threading.Thread(target=periodically_print_status,
    exitcode = expandlibs_exec.main(args, proc_callback=callback)
    # Wait for the background thread to finish.
    return exitcode

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print >>sys.stderr, "Usage: <commandline>"