(script)
| 456 | |
| 457 | |
| 458 | def make_js_executable(script): |
| 459 | src = read_file(script) |
| 460 | |
| 461 | # By default, the resulting script will run under the version of node in the PATH. |
| 462 | if settings.EXECUTABLE == 1: |
| 463 | settings.EXECUTABLE = '/usr/bin/env node' |
| 464 | |
| 465 | logger.debug(f'adding `#!` to JavaScript file: {settings.EXECUTABLE}') |
| 466 | # add shebang |
| 467 | with open(script, 'w', encoding='utf-8') as f: |
| 468 | f.write(f'#!{settings.EXECUTABLE}\n') |
| 469 | f.write(src) |
| 470 | try: |
| 471 | os.chmod(script, stat.S_IMODE(os.stat(script).st_mode) | stat.S_IXUSR) # make executable |
| 472 | except OSError: |
| 473 | pass # can fail if e.g. writing the executable to /dev/null |
| 474 | |
| 475 | |
| 476 | def do_split_module(wasm_file, options): |
no test coverage detected