servo: Merge #12020 - Add shebang to Linux runservo.sh (from crepererum:fix/shebang); r=aneeshusa
authorMarco Neumann <marco@crepererum.net>
Fri, 01 Jul 2016 17:33:22 -0700
changeset 339181 c06a899f00b7a16d6a1ae8cbabaab896aeba5eba
parent 339180 8dc516fac603c00d286225609871344e8b2fd7f7
child 339182 0085c13d54dccdfe2516f23d75dd960ec3d62a1b
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaneeshusa
servo: Merge #12020 - Add shebang to Linux runservo.sh (from crepererum:fix/shebang); r=aneeshusa <!-- Please describe your changes on the following line: --> Shebang is missing and therefore `./runservo.sh` does not work under some environments. I've chosen to use `/usr/bin/env sh` instead of `/bin/sh` or `/usr/bin/sh` to auto-select the right `sh` executable depending on the environment. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] These changes do not require tests because it does not affect servo itself but rather the resulting package under some environments. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 1ed06777ee1e69c8b56715c897a5bd66ad9e235e
servo/python/servo/package_commands.py
--- a/servo/python/servo/package_commands.py
+++ b/servo/python/servo/package_commands.py
@@ -172,17 +172,17 @@ class PackageCommands(CommandBase):
             # TODO: deduplicate this arg list from post_build_commands
             servo_args = ['-w', '-b',
                           '--pref', 'dom.mozbrowser.enabled',
                           '--pref', 'dom.forcetouch.enabled',
                           '--pref', 'shell.builtin-key-shortcuts.enabled=false',
                           path.join('./build/' + browserhtml_path.split('/')[-1], 'out', 'index.html')]
 
             runservo = os.open(dir_to_package + '/runservo.sh', os.O_WRONLY | os.O_CREAT, int("0755", 8))
-            os.write(runservo, "./servo " + ' '.join(servo_args))
+            os.write(runservo, "#!/usr/bin/env sh\n./servo " + ' '.join(servo_args))
             os.close(runservo)
             print("Creating tarball")
             tar_path = '/'.join(dir_to_package.split('/')[:-1]) + '/'
             tar_path += datetime.utcnow().replace(microsecond=0).isoformat()
             tar_path += "-servo-tech-demo.tar.gz"
             with tarfile.open(tar_path, "w:gz") as tar:
                 # arcname is to add by relative rather than absolute path
                 tar.add(dir_to_package, arcname='servo/')