Commit 62d03fb
authored
Implement support for reading argc and argv in MINIMAL_RUNTIME. (#25307)
Implement support for reading argc and argv in MINIMAL_RUNTIME. With the
help of the existing MAIN_READS_PARAMS machinery (thanks to
#9064), this is
only-pay-for-what-you-use.
Note that unlike the regular runtime that locates `argv[0]` to be the
script name, MINIMAL_RUNTIME will place the shell interpreter name in
`argv[0]` and the script name in `argv[1]`, to align with Node.js and
Python `process.argv` and `sys.argv` behavior.
In a browser run, regular runtime has a dummy `"./this.program"` in
`argv[0]`. Instead of a hardcoded mock value in `argv[0]`, the current
page URL (e.g. `"https://localhost:5932/foo/bar/baz.html"`) is located
in `argv[0]` instead, followed by the search query parameters in
`argv[1]` onwards.1 parent 8d9966a commit 62d03fb
File tree
2 files changed
+46
-10
lines changed- src
- test/codesize
2 files changed
+46
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
36 | 72 | | |
37 | 73 | | |
38 | 74 | | |
39 | 75 | | |
40 | | - | |
| 76 | + | |
41 | 77 | | |
42 | 78 | | |
43 | 79 | | |
44 | | - | |
| 80 | + | |
45 | 81 | | |
46 | 82 | | |
47 | | - | |
| 83 | + | |
48 | 84 | | |
49 | 85 | | |
50 | | - | |
| 86 | + | |
51 | 87 | | |
52 | 88 | | |
53 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
0 commit comments