@poe-platform/safe-bash 0.1.800 → 0.1.801
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -5
- package/dist/image-ast/index.browser.js +119 -75
- package/dist/image-ast/index.js +119 -75
- package/dist/pdf-ast/index.js +4 -3
- package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-4SEW2Q6H.js → chunk-3R3AANOR.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-HHW7MGS2.js → chunk-45PK3NWI.js} +4 -4
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
- package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-RMWLWH7Q.js → chunk-7VNF5BFF.js} +300 -737
- package/dist/safe-bash/chunks/{chunk-QVSRRNZT.js → chunk-A7XEHALN.js} +4 -4
- package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
- package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-BHJE5LPZ.js → chunk-D3ANYGMC.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NLAW7KDI.js → chunk-E7OYNDGL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-RKKRJ54E.js → chunk-FNDNHAGE.js} +30 -23
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-ICFDYV64.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-TYD7EVUJ.js → chunk-IVRQ4BXL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-K2VCOJ2B.js → chunk-K6VCD7IY.js} +7 -12
- package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-NR3EM4LS.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-TFGRKY43.js → chunk-OQRVVGR6.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PPYM75Z3.js → chunk-OV6IHKO6.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-KW24TAIU.js → chunk-PQRAK7HU.js} +920 -432
- package/dist/safe-bash/chunks/{chunk-K4YMYFRJ.js → chunk-SZH7EJLD.js} +116 -697
- package/dist/safe-bash/chunks/{chunk-7YSRXFEG.js → chunk-TFIBK2GI.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I7L3G3NX.js → chunk-UE5KZDEK.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JTLSUJ7V.js → chunk-VQDD3G76.js} +42 -25
- package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/{csvkit-QGP3GAOB.js → csvkit-TACDU7FC.js} +3 -3
- package/dist/safe-bash/chunks/{ffmpeg-JTVH26MK.js → ffmpeg-WTC3TEFI.js} +2 -2
- package/dist/safe-bash/chunks/{gh-I7QX7N5C.js → gh-6WU6PXL4.js} +2 -2
- package/dist/safe-bash/chunks/{git-MA7NKYVP.js → git-EFZIGJW4.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-Y4NPWX2Q.js → imagemagick-EIEYGWPF.js} +2 -2
- package/dist/safe-bash/chunks/{implementation-BWDKOVQJ.js → implementation-MLFHUQ5M.js} +2 -2
- package/dist/safe-bash/chunks/{mmdc-44PELHDG.js → mmdc-ROQJT5HQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdfimages-635TRW4Q.js → pdfimages-DW7LWXFI.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-FSDAA2KY.js → pdfinfo-TIP6XLUQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftk-GQ5UH3VG.js → pdftk-DMG22ITZ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-YTXQCAYT.js → pdftoppm-WNDYR72T.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-CVA2G7FY.js → pdftotext-5IPZ4NI7.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-HZMIFG4A.js → qpdf-TTX2DIUA.js} +2 -2
- package/dist/safe-bash/chunks/{sips-E7UBDP33.js → sips-XYS46JPJ.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-ELASUWUK.js → soffice-TU73E5KL.js} +2 -2
- package/dist/safe-bash/chunks/{wkhtmltopdf-EPO6YCMG.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-5LSGEIZY.js → chunk-3HHCU5YU.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2QHG43WJ.js → chunk-4BB2SWJ5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
- package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-L6DVEBW3.js → chunk-5BSTFCXG.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Q3DII3Q7.js → chunk-5PWJG2UK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
- package/dist/safe-bash/command-chunks/{chunk-V6MSPQLA.js → chunk-6BNTBWIK.js} +4 -39
- package/dist/safe-bash/command-chunks/{chunk-JN7WIP6S.js → chunk-6KJ3LPI2.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
- package/dist/safe-bash/command-chunks/{chunk-TEVJJPTC.js → chunk-7U7EXOXX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
- package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
- package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
- package/dist/safe-bash/command-chunks/{chunk-CKXV2CLD.js → chunk-ARBYOQUZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
- package/dist/safe-bash/command-chunks/{chunk-53P53XFM.js → chunk-BPE5INLI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WB5SVIG7.js → chunk-C5YYCQHW.js} +498 -88
- package/dist/safe-bash/command-chunks/{chunk-EUSPTFAX.js → chunk-CAP7ZJSY.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-GI4CJED2.js → chunk-CQTRW45K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-CZ7EN3JG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-QJAFJP2G.js → chunk-DZCY63VJ.js} +12 -10
- package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-F6OYH562.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
- package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
- package/dist/safe-bash/command-chunks/{chunk-E2LB7FRT.js → chunk-FXOA7RBK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QWIDNAAK.js → chunk-FZTK4MFI.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
- package/dist/safe-bash/command-chunks/{chunk-YJDV76GL.js → chunk-GFQZCKO6.js} +29 -19
- package/dist/safe-bash/command-chunks/{chunk-FKKB5X5V.js → chunk-GOB777HR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IYPAQ7PH.js → chunk-GRBWW4SG.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-PJJUYO3R.js → chunk-II77KPZN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-VL67NWNS.js → chunk-JDYXY44P.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BKCNF5U3.js → chunk-KQLD3AED.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UMDIOL3O.js → chunk-KXU3IRUO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QZF3SINC.js → chunk-LAOM65EE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
- package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-U6G67N23.js → chunk-MIXBO6U7.js} +18 -5
- package/dist/safe-bash/command-chunks/{chunk-JQ74HC37.js → chunk-MQFIPHIQ.js} +23 -50
- package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
- package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
- package/dist/safe-bash/command-chunks/{chunk-RVLO4DYT.js → chunk-N4PFUSRM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-D4OP2BR3.js → chunk-NKFYQSES.js} +1 -2
- package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
- package/dist/safe-bash/command-chunks/{chunk-TYCGMRLM.js → chunk-OYYV7ZAF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SVULUDOP.js → chunk-P2N33UMN.js} +20 -81
- package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-SAMH7SQE.js → chunk-PCEFOYA3.js} +237 -145
- package/dist/safe-bash/command-chunks/{chunk-3HXDA5PT.js → chunk-PMBFZXTK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3LSOYLNV.js → chunk-QKFSRZGQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LC2MFKT4.js → chunk-RMWQAAO5.js} +24 -25
- package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4C6QI5BQ.js → chunk-RZZI24ZE.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
- package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6HMX4CQS.js → chunk-TGSNCQSR.js} +44 -16
- package/dist/safe-bash/command-chunks/{chunk-5T7CRJHW.js → chunk-TIOCQVUQ.js} +4 -7
- package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-TNOA7FCQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-7RGB363W.js → chunk-TSCGT46G.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ERYJLO6G.js → chunk-V7A7DRTU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
- package/dist/safe-bash/command-chunks/{chunk-XETLEHZP.js → chunk-VPR5LQYX.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3DT2YOGW.js → chunk-VSRGNQCP.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-J5SN3PZ3.js → chunk-VXSLJH7G.js} +53 -3
- package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-YGC6OS5O.js → chunk-WECIOOQB.js} +5 -8
- package/dist/safe-bash/command-chunks/{chunk-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
- package/dist/safe-bash/command-chunks/{chunk-Z7RVSD5K.js → chunk-WVHONVZ4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QNIMV57G.js → chunk-XNLFHHOC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
- package/dist/safe-bash/command-chunks/{chunk-KYSPGS33.js → chunk-YIQACGEW.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-NAY27PXB.js → chunk-YOFC45RK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QI7LGHJJ.js → chunk-Z45N42QC.js} +21 -6
- package/dist/safe-bash/command-chunks/{chunk-67IQF5GC.js → chunk-ZYHTWNAE.js} +23 -9
- package/dist/safe-bash/command-chunks/{chunk-STC3LEWJ.js → chunk-ZYXH3B66.js} +5 -3
- package/dist/safe-bash/commands/bytes/compression/index.js +3 -2
- package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/docx/index.browser.js +1 -1
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +17 -13
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- package/dist/safe-bash/commands/network/curl.d.ts +1 -1
- package/dist/safe-bash/commands/network/curl.js +1 -3
- package/dist/safe-bash/commands/network/index.browser.js +4 -4
- package/dist/safe-bash/commands/network/platform-portable.d.ts +1 -5
- package/dist/safe-bash/commands/network/platform-portable.js +1 -26
- package/dist/safe-bash/commands/network/public.d.ts +2 -2
- package/dist/safe-bash/commands/network/public.js +2 -2
- package/dist/safe-bash/commands/network/transport.js +2 -2
- package/dist/safe-bash/commands/network/wget.d.ts +1 -1
- package/dist/safe-bash/commands/network/wget.js +1 -3
- package/dist/safe-bash/commands/node/filesystem.js +3 -2
- package/dist/safe-bash/commands/node/index.browser.js +8 -8
- package/dist/safe-bash/commands/node/types.js +1 -1
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
- package/dist/safe-bash/commands/python/index.browser.js +11 -11
- package/dist/safe-bash/commands/python/manifest.d.ts +1 -0
- package/dist/safe-bash/commands/python/manifest.js +6 -3
- package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
- package/dist/safe-bash/commands/python/shell-capability.js +3 -2
- package/dist/safe-bash/commands/python/worker.browser.js +3 -3
- package/dist/safe-bash/commands/regex-execution/public.browser.js +4 -4
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- package/dist/safe-bash/commands/standard.d.ts +1 -0
- package/dist/safe-bash/commands/standard.js +2 -1
- package/dist/safe-bash/commands/streams.js +6 -24
- package/dist/safe-bash/commands/text.js +268 -364
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +2 -2
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/core.d.ts +6 -1
- package/dist/safe-bash/core.js +1 -1
- package/dist/safe-bash/full-core.browser.js +108 -104
- package/dist/safe-bash/jobs.browser.js +5 -5
- package/dist/safe-bash/opt-in/commands/dd/index.js +2 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
- package/dist/safe-bash/optional-host.browser.js +11 -11
- package/dist/safe-bash/plugins/composition.d.ts +1 -0
- package/dist/safe-bash/plugins/composition.js +3 -8
- package/dist/safe-bash/plugins/index.browser.js +27 -27
- package/dist/safe-bash/registry-entry.browser.js +28 -28
- package/dist/safe-bash/shell/arrays/bindings.js +1 -1
- package/dist/safe-bash/shell/arrays/state.js +4 -0
- package/dist/safe-bash/shell/brace-expansion.js +1 -1
- package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
- package/dist/safe-bash/shell/dynamic-variables.js +25 -0
- package/dist/safe-bash/shell/parser.js +8 -1
- package/dist/safe-bash/shell/runtime.d.ts +4 -4
- package/dist/safe-bash/shell/runtime.js +291 -741
- package/dist/safe-bash/shell/shell.js +2 -31
- package/dist/safe-bash/shell-entry.browser.js +25 -25
- package/dist/safe-bash/trap.browser.js +4 -4
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-base-encoding-engine/base.js +2 -2
- package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
- package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
- package/dist/safe-bash-byte-input-engine/index.js +4 -1
- package/dist/safe-bash-checksum-engine/index.js +13 -6
- package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +4 -3
- package/dist/safe-bash-command-apply-patch/index.js +3 -3
- package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
- package/dist/safe-bash-command-apply-patch/parser.js +1 -1
- package/dist/safe-bash-command-awk/awk-inspection.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
- package/dist/safe-bash-command-awk/awk-syntax.d.ts +1 -1
- package/dist/safe-bash-command-awk/awk-syntax.js +2 -2
- package/dist/safe-bash-command-awk/awk-values.js +1 -1
- package/dist/safe-bash-command-awk/awk.js +5 -5
- package/dist/safe-bash-command-awk/index.js +5 -5
- package/dist/safe-bash-command-bc/index.d.ts +2 -0
- package/dist/safe-bash-command-bc/index.js +123 -92
- package/dist/safe-bash-command-column/column.js +5 -5
- package/dist/safe-bash-command-column/display.d.ts +1 -1
- package/dist/safe-bash-command-column/display.js +1 -1
- package/dist/safe-bash-command-column/index.js +5 -5
- package/dist/safe-bash-command-column/internal.d.ts +0 -2
- package/dist/safe-bash-command-column/internal.js +1 -1
- package/dist/safe-bash-command-column/layout.js +4 -4
- package/dist/safe-bash-command-column/table.js +2 -2
- package/dist/safe-bash-command-comm/comm.js +1 -1
- package/dist/safe-bash-command-comm/index.js +1 -1
- package/dist/safe-bash-command-csvcut/index.d.ts +1 -0
- package/dist/safe-bash-command-csvcut/index.js +1 -0
- package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
- package/dist/safe-bash-command-csvgrep/index.js +2 -2
- package/dist/safe-bash-command-csvkit/index.js +9 -9
- package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
- package/dist/safe-bash-command-curl/curl.js +1 -1
- package/dist/safe-bash-command-curl/index.js +1 -1
- package/dist/safe-bash-command-dd/index.js +2 -0
- package/dist/safe-bash-command-diff/diff.js +1 -1
- package/dist/safe-bash-command-diff/index.js +1 -1
- package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
- package/dist/safe-bash-command-fd/index.js +9 -9
- package/dist/safe-bash-command-ffmpeg/index.js +31 -8
- package/dist/safe-bash-command-file/index.js +1 -1
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-find/find.js +1 -1
- package/dist/safe-bash-command-find/index.js +1 -1
- package/dist/safe-bash-command-gzip/index.js +3 -2
- package/dist/safe-bash-command-hexdump/command.js +4 -4
- package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
- package/dist/safe-bash-command-hexdump/index.js +4 -4
- package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
- package/dist/safe-bash-command-hexdump/internal.js +1 -1
- package/dist/safe-bash-command-hexdump/io.js +2 -2
- package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
- package/dist/safe-bash-command-hexdump/options.js +2 -2
- package/dist/safe-bash-command-hostname/index.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +6 -6
- package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/parser.d.ts +1 -0
- package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
- package/dist/safe-bash-command-htmlq/index.d.ts +1 -0
- package/dist/safe-bash-command-htmlq/index.js +27 -9
- package/dist/safe-bash-command-iconv/codec.js +1 -1
- package/dist/safe-bash-command-iconv/command.js +2 -2
- package/dist/safe-bash-command-iconv/index.js +2 -2
- package/dist/safe-bash-command-imagemagick/index.js +24 -6
- package/dist/safe-bash-command-join/index.js +1 -1
- package/dist/safe-bash-command-join/join.js +1 -1
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-less/index.js +43 -28
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -0
- package/dist/safe-bash-command-numfmt/index.js +0 -11
- package/dist/safe-bash-command-od/index.js +101 -68
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-paste/index.js +1 -1
- package/dist/safe-bash-command-paste/paste.js +1 -1
- package/dist/safe-bash-command-pathchk/index.js +3 -13
- package/dist/safe-bash-command-pdfimages/index.js +27 -11
- package/dist/safe-bash-command-pdfinfo/index.js +19 -10
- package/dist/safe-bash-command-pdftk/index.js +3 -3
- package/dist/safe-bash-command-pdftoppm/index.js +26 -10
- package/dist/safe-bash-command-pdftotext/index.js +27 -13
- package/dist/safe-bash-command-qpdf/index.js +5 -5
- package/dist/safe-bash-command-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- package/dist/safe-bash-command-shuf/options.d.ts +1 -0
- package/dist/safe-bash-command-shuf/options.js +2 -4
- package/dist/safe-bash-command-shuf/shuf.js +2 -1
- package/dist/safe-bash-command-soffice/index.js +20 -16
- package/dist/safe-bash-command-split/index.js +3 -3
- package/dist/safe-bash-command-split/io.js +1 -1
- package/dist/safe-bash-command-split/outputs.js +2 -2
- package/dist/safe-bash-command-split/split.js +3 -3
- package/dist/safe-bash-command-sqlite3/btree.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/engine.d.ts +6 -0
- package/dist/safe-bash-command-sqlite3/index.js +284 -85
- package/dist/safe-bash-command-ssconvert/commands.js +9 -9
- package/dist/safe-bash-command-ssconvert/core.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/ods.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +8 -8
- package/dist/safe-bash-command-ssconvert/index.js +20 -20
- package/dist/safe-bash-command-tar/extract.js +1 -1
- package/dist/safe-bash-command-tar/index.js +5 -4
- package/dist/safe-bash-command-tar/modes.js +2 -2
- package/dist/safe-bash-command-tree/arguments.js +3 -3
- package/dist/safe-bash-command-tree/charset.js +1 -1
- package/dist/safe-bash-command-tree/index.js +4 -4
- package/dist/safe-bash-command-tree/io.js +1 -1
- package/dist/safe-bash-command-tree/pattern.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +4 -4
- package/dist/safe-bash-command-unrtf/index.js +14 -7
- package/dist/safe-bash-command-unzip/index.js +1 -1
- package/dist/safe-bash-command-unzip/unzip.js +1 -1
- package/dist/safe-bash-command-wget/index.js +1 -1
- package/dist/safe-bash-command-wget/wget.js +1 -1
- package/dist/safe-bash-command-xan/argv.d.ts +1 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +5 -3
- package/dist/safe-bash-command-xan/csv.d.ts +1 -1
- package/dist/safe-bash-command-xan/csv.js +1 -1
- package/dist/safe-bash-command-xan/index.js +7 -7
- package/dist/safe-bash-command-xan/io.js +3 -3
- package/dist/safe-bash-command-xmllint/index.js +1 -1
- package/dist/safe-bash-command-xxd/index.js +105 -91
- package/dist/safe-bash-command-xz/command.d.ts +2 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +8 -0
- package/dist/safe-bash-command-yq/query.js +1 -1
- package/dist/safe-bash-command-zip/index.js +1 -1
- package/dist/safe-bash-command-zip/zip.js +1 -1
- package/dist/safe-bash-contracts/escaping.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +2 -2
- package/dist/safe-bash-contracts/index.d.ts +1 -0
- package/dist/safe-bash-contracts/index.js +7 -3
- package/dist/safe-bash-contracts/io.d.ts +4 -1
- package/dist/safe-bash-contracts/io.js +3 -1
- package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
- package/dist/safe-bash-contracts/output.js +2 -2
- package/dist/safe-bash-diff-engine/index.js +1 -1
- package/dist/safe-bash-diff-engine/shared.d.ts +3 -2
- package/dist/safe-bash-diff-engine/shared.js +1 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
- package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +33 -44
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-mcp/index.browser.d.ts +155 -35
- package/dist/safe-bash-mcp/index.browser.js +416 -0
- package/dist/safe-bash-mcp/index.d.ts +54 -2
- package/dist/safe-bash-mcp/index.js +283 -89
- package/dist/safe-bash-network-engine/aggregate.js +2 -2
- package/dist/safe-bash-network-engine/args.js +4 -4
- package/dist/safe-bash-network-engine/authorizer.js +1 -1
- package/dist/safe-bash-network-engine/body.js +6 -6
- package/dist/safe-bash-network-engine/decode.d.ts +1 -1
- package/dist/safe-bash-network-engine/decode.js +3 -4
- package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
- package/dist/safe-bash-network-engine/form-content-type.js +2 -2
- package/dist/safe-bash-network-engine/form-headers.js +2 -2
- package/dist/safe-bash-network-engine/glob.js +1 -1
- package/dist/safe-bash-network-engine/index.js +4 -4
- package/dist/safe-bash-network-engine/input.js +6 -6
- package/dist/safe-bash-network-engine/output.js +2 -2
- package/dist/safe-bash-network-engine/platform-portable.js +3 -3
- package/dist/safe-bash-network-engine/shared.js +2 -2
- package/dist/safe-bash-network-engine/types.d.ts +7 -2
- package/dist/safe-bash-network-engine/types.js +1 -1
- package/dist/safe-bash-network-engine/url.js +2 -2
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +11 -11
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +9 -9
- package/dist/safe-bash-query-engine/parser.js +1 -1
- package/dist/safe-bash-query-engine/query-core.js +11 -11
- package/dist/safe-bash-query-engine/regex.js +4 -4
- package/dist/safe-bash-query-engine/splits.js +5 -5
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/dist/safe-bash-regex-engine/ere/matcher.js +102 -30
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
- package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
- package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
- package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
- package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
- package/dist/safe-bash-regex-engine/index.js +6 -4
- package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -0
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +14 -0
- package/dist/safe-bash-regex-engine/text/regex.js +6 -4
- package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
- package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +189 -227
- package/dist/safe-bash-table-text-engine/table-text/internal.d.ts +7 -5
- package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
- package/dist/safe-playwright-cloudflare/browser-trace-budget.js +6 -2
- package/dist/spreadsheet-engine/codecs/odf-hyperlinks.js +8 -2
- package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
- package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
- package/dist/spreadsheet-engine/formulas/parser.js +3 -1
- package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
- package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
- package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
- package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
- package/dist/spreadsheet-format-xls/biff.js +1 -1
- package/dist/xlsx-ast/xlsx.js +8 -5
- package/package.json +9 -8
- package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
- /package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
|
@@ -1,41 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
evalSyncYqPrep,
|
|
3
3
|
formatSyncYqYamlLines
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TFIBK2GI.js";
|
|
5
5
|
import {
|
|
6
6
|
captureIgnoredTrapSignals,
|
|
7
7
|
defaultPortableTrapExtension,
|
|
8
8
|
isIdlePortableTrapInstance
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3NDIFSNM.js";
|
|
10
10
|
import {
|
|
11
11
|
abortManagedController,
|
|
12
12
|
addAbortSignalWaiter,
|
|
13
13
|
bindFileOutputBudget,
|
|
14
14
|
clearRgFastRunnerPool,
|
|
15
15
|
combineManagedSignals,
|
|
16
|
-
createBcCommands,
|
|
17
|
-
createCalCommands,
|
|
18
|
-
createDdCommands,
|
|
19
|
-
createDfCommands,
|
|
20
|
-
createEnvsubstCommands,
|
|
21
|
-
createFdCommands,
|
|
22
16
|
createFmtEngine,
|
|
23
|
-
createGetconfCommands,
|
|
24
|
-
createHostnameCommands,
|
|
25
|
-
createIdCommands,
|
|
26
|
-
createLessCommands,
|
|
27
|
-
createLocaleCommands,
|
|
28
17
|
createManagedControlController,
|
|
29
|
-
createNprocCommands,
|
|
30
|
-
createNumfmtCommands,
|
|
31
|
-
createPathchkCommands,
|
|
32
|
-
createShufCommands,
|
|
33
|
-
createSpongeCommands,
|
|
34
|
-
createSqlite3Commands,
|
|
35
|
-
createStreamFormatCommands,
|
|
36
|
-
createStreamInspectionCommands,
|
|
37
|
-
createUnameCommands,
|
|
38
|
-
createWhoamiCommands,
|
|
39
18
|
creationUmask,
|
|
40
19
|
defaultEchoExecutors,
|
|
41
20
|
defaultMkdirExecutors,
|
|
@@ -87,37 +66,37 @@ import {
|
|
|
87
66
|
tryFastPrintf,
|
|
88
67
|
variablePresence,
|
|
89
68
|
wcDisplayWidth
|
|
90
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-SZH7EJLD.js";
|
|
91
70
|
import {
|
|
92
71
|
evalSyncGetopt
|
|
93
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-AUSNDQTJ.js";
|
|
94
73
|
import {
|
|
95
74
|
evalSyncIconv
|
|
96
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-CTVWDACF.js";
|
|
97
76
|
import {
|
|
98
77
|
evalSyncLineEndings
|
|
99
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-3R3AANOR.js";
|
|
100
79
|
import {
|
|
101
80
|
evalSyncMdq
|
|
102
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-OV6IHKO6.js";
|
|
103
82
|
import {
|
|
104
83
|
evalSyncXmllint,
|
|
105
84
|
evalSyncXq
|
|
106
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-C5OWC2TL.js";
|
|
107
86
|
import {
|
|
108
87
|
PublicDiagnostic,
|
|
109
88
|
publicDiagnosticMessage,
|
|
110
89
|
writeDiagnostic
|
|
111
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-IVRQ4BXL.js";
|
|
112
91
|
import {
|
|
113
92
|
bytesToHex,
|
|
114
93
|
compareUtf8,
|
|
115
94
|
latin1Bytes,
|
|
116
95
|
latin1Text
|
|
117
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-D3ANYGMC.js";
|
|
118
97
|
import {
|
|
119
98
|
evalSyncPr
|
|
120
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-CHYGPFVM.js";
|
|
121
100
|
import {
|
|
122
101
|
EreLedger,
|
|
123
102
|
EreProfileLimitError,
|
|
@@ -127,10 +106,10 @@ import {
|
|
|
127
106
|
matchEre,
|
|
128
107
|
tryCompileEreSync,
|
|
129
108
|
tryMatchEreSync
|
|
130
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-6O77NL2S.js";
|
|
131
110
|
import {
|
|
132
111
|
jobsExtension
|
|
133
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-A7XEHALN.js";
|
|
134
113
|
import {
|
|
135
114
|
concatShellValues,
|
|
136
115
|
shellValueByteLength,
|
|
@@ -138,14 +117,14 @@ import {
|
|
|
138
117
|
shellValueFromBytes,
|
|
139
118
|
shellValueRetainedBytes,
|
|
140
119
|
shellValueText
|
|
141
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-J42RIHHJ.js";
|
|
142
121
|
import {
|
|
143
122
|
openCommandFile
|
|
144
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-I5HZ4FGE.js";
|
|
145
124
|
import {
|
|
146
125
|
FsError,
|
|
147
126
|
isFsError
|
|
148
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-VTH3MLDU.js";
|
|
149
128
|
import {
|
|
150
129
|
basename,
|
|
151
130
|
cancelTurn,
|
|
@@ -160,7 +139,7 @@ import {
|
|
|
160
139
|
runYieldCheckpoint,
|
|
161
140
|
scheduleTurn,
|
|
162
141
|
yieldTurn
|
|
163
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-NZQXYWA3.js";
|
|
164
143
|
import {
|
|
165
144
|
createBytePipe,
|
|
166
145
|
outputFailure,
|
|
@@ -168,14 +147,14 @@ import {
|
|
|
168
147
|
toByteSource,
|
|
169
148
|
writeBytes,
|
|
170
149
|
writeText
|
|
171
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-74GHTNJA.js";
|
|
172
151
|
import {
|
|
173
152
|
CommandRegistry,
|
|
174
153
|
commandRuntimeIdentity,
|
|
175
154
|
createCommandArguments,
|
|
176
155
|
getCommandArguments,
|
|
177
156
|
validateExitCode
|
|
178
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-7R5BDCG7.js";
|
|
179
158
|
import {
|
|
180
159
|
RESOLVED_EXIT_ONE,
|
|
181
160
|
RESOLVED_EXIT_ZERO,
|
|
@@ -185,10 +164,10 @@ import {
|
|
|
185
164
|
registerDefaultExecutor,
|
|
186
165
|
registerDefaultExecutors,
|
|
187
166
|
syncCommandEvaluators
|
|
188
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-E7OYNDGL.js";
|
|
189
168
|
import {
|
|
190
169
|
init_platform
|
|
191
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-B7TAL7S5.js";
|
|
192
171
|
|
|
193
172
|
// packages/safe-bash/src/fs/memory/index.ts
|
|
194
173
|
init_platform();
|
|
@@ -2390,6 +2369,7 @@ shell: command substitution: line ${line}: \`${sourceLine}'
|
|
|
2390
2369
|
const unprinted = this.unprintedWords;
|
|
2391
2370
|
const parts = [];
|
|
2392
2371
|
let parentheses = 0;
|
|
2372
|
+
let brackets = 0;
|
|
2393
2373
|
let conditionals = 0;
|
|
2394
2374
|
let patternParentheses = 0;
|
|
2395
2375
|
let regexBracket = false;
|
|
@@ -2455,7 +2435,10 @@ shell: command substitution: line ${line}: \`${sourceLine}'
|
|
|
2455
2435
|
} else if (current === ")" && patternParentheses > 0) patternParentheses--;
|
|
2456
2436
|
else if (/[()<>]/u.test(current) || patternParentheses === 0 && (this.source.startsWith("&&", this.position) || this.source.startsWith("||", this.position))) break;
|
|
2457
2437
|
} else if (terminator) {
|
|
2458
|
-
if (terminator.includes(
|
|
2438
|
+
if (terminator.includes("]") && current === "[") {
|
|
2439
|
+
if (++brackets > this.budget.maxSyntaxDepth) this.error(`Subscript syntax nesting exceeds ${this.budget.maxSyntaxDepth}`);
|
|
2440
|
+
} else if (current === "]" && brackets > 0) brackets--;
|
|
2441
|
+
else if (terminator.includes(current) && (!arithmetic || current !== ":" || parentheses === 0 && conditionals === 0)) break;
|
|
2459
2442
|
} else if (!this.braceReplay) {
|
|
2460
2443
|
if (!enclosingQuoted && !literal && current === "(" && (patternParentheses > 0 || this.position > offset && "?*+@!".includes(this.source[this.position - 1] ?? " ") && (this.position - 1 === offset || this.source[this.position - 2] !== "\\") && !(this.source[this.position + 1] === ")" && /^\(\)\s*(?:\{|\(|if\b|case\b|while\b|until\b|for\b|select\b|\[\[)/u.test(this.source.slice(this.position))) && this.hasClosingExtglobParen(this.position))) {
|
|
2461
2444
|
if (++patternParentheses > this.budget.maxSyntaxDepth) this.error(`Syntax nesting exceeds ${this.budget.maxSyntaxDepth}`);
|
|
@@ -7619,7 +7602,7 @@ function tryFastExpandBraceRange(word, budget, reserveBytes) {
|
|
|
7619
7602
|
for (let i = 0; i < text3.length; i++) {
|
|
7620
7603
|
if (i === open || i === close) continue;
|
|
7621
7604
|
const c = text3.charCodeAt(i);
|
|
7622
|
-
if (c === 123 || c === 125 || c === 44 || c === 92 || c === 126 || c === 42 || c === 63 || c === 91 || c === 32 || c === 9 || c === 10) {
|
|
7605
|
+
if (c === 123 || c === 125 || c === 44 || c === 92 || c === 126 || c === 40 || c === 42 || c === 63 || c === 91 || c === 32 || c === 9 || c === 10) {
|
|
7623
7606
|
braceRangeWordCache.set(word, null);
|
|
7624
7607
|
return void 0;
|
|
7625
7608
|
}
|
|
@@ -11103,7 +11086,10 @@ var controlNames = /* @__PURE__ */ new Set([
|
|
|
11103
11086
|
"REPLY",
|
|
11104
11087
|
"LANG",
|
|
11105
11088
|
"LC_ALL",
|
|
11106
|
-
"LC_CTYPE"
|
|
11089
|
+
"LC_CTYPE",
|
|
11090
|
+
"RANDOM",
|
|
11091
|
+
"SECONDS",
|
|
11092
|
+
"LINENO"
|
|
11107
11093
|
]);
|
|
11108
11094
|
var OwnedText = class {
|
|
11109
11095
|
constructor(shellValue, bytes, admission) {
|
|
@@ -11727,6 +11713,30 @@ var BindingStore = class _BindingStore {
|
|
|
11727
11713
|
}
|
|
11728
11714
|
};
|
|
11729
11715
|
|
|
11716
|
+
// packages/safe-bash/src/shell/dynamic-variables.ts
|
|
11717
|
+
init_platform();
|
|
11718
|
+
function writeDynamicVariable(state, name2, value) {
|
|
11719
|
+
if (name2 !== "RANDOM" && name2 !== "SECONDS") return;
|
|
11720
|
+
const number2 = Number.parseInt(value, 10) || 0;
|
|
11721
|
+
if (name2 === "RANDOM" && !state.randomDisabled) {
|
|
11722
|
+
state.randomSeed = (number2 >>> 0) % 2147483647 || 1;
|
|
11723
|
+
} else if (name2 === "SECONDS" && !state.secondsDisabled) {
|
|
11724
|
+
state.secondsOrigin = Date.now() - number2 * 1e3;
|
|
11725
|
+
}
|
|
11726
|
+
}
|
|
11727
|
+
function readDynamicVariable(state, name2) {
|
|
11728
|
+
if (name2 === "RANDOM" && !state.randomDisabled) {
|
|
11729
|
+
const seed = (state.randomSeed ?? 1) * 16807 % 2147483647;
|
|
11730
|
+
state.randomSeed = seed;
|
|
11731
|
+
return String((seed ^ seed >>> 16) & 32767);
|
|
11732
|
+
}
|
|
11733
|
+
if (name2 === "SECONDS" && !state.secondsDisabled) {
|
|
11734
|
+
state.secondsOrigin ??= Date.now();
|
|
11735
|
+
return String(Math.floor((Date.now() - state.secondsOrigin) / 1e3));
|
|
11736
|
+
}
|
|
11737
|
+
return void 0;
|
|
11738
|
+
}
|
|
11739
|
+
|
|
11730
11740
|
// packages/safe-bash/src/shell/mapfile.ts
|
|
11731
11741
|
init_platform();
|
|
11732
11742
|
var MapfileUsageError = class extends Error {
|
|
@@ -12302,6 +12312,7 @@ var StateMonitor = class {
|
|
|
12302
12312
|
publishStringVariable(name2, value) {
|
|
12303
12313
|
const tickets = this.mutation(name2);
|
|
12304
12314
|
this.values.publishString(name2, value, this.raw.variables);
|
|
12315
|
+
writeDynamicVariable(this.raw, name2, value);
|
|
12305
12316
|
this.finish(tickets, name2);
|
|
12306
12317
|
}
|
|
12307
12318
|
publish(tickets, name2, action) {
|
|
@@ -12472,6 +12483,7 @@ var StateProxyHandler = class {
|
|
|
12472
12483
|
const name2 = this.named ? String(key) : void 0;
|
|
12473
12484
|
const tickets = this.monitor.mutation(name2);
|
|
12474
12485
|
const result = Reflect.set(target, key, entry);
|
|
12486
|
+
if (result && this.field === "variables" && typeof key === "string" && typeof entry === "string") writeDynamicVariable(this.monitor.raw, key, entry);
|
|
12475
12487
|
if (result) this.monitor.changedValue(target, this.field, key);
|
|
12476
12488
|
this.monitor.finish(tickets, name2);
|
|
12477
12489
|
return result;
|
|
@@ -14062,8 +14074,6 @@ Object.assign(Budget2.prototype, {
|
|
|
14062
14074
|
_hasExternalSignal: false
|
|
14063
14075
|
});
|
|
14064
14076
|
var EMPTY_CAPTURE_BYTES = new Uint8Array(0);
|
|
14065
|
-
var sharedCaptureStdoutScratch = new Uint8Array(65536);
|
|
14066
|
-
var sharedCaptureStderrScratch = new Uint8Array(65536);
|
|
14067
14077
|
var Capture = class {
|
|
14068
14078
|
constructor(budget, signal) {
|
|
14069
14079
|
this._chunks = void 0;
|
|
@@ -14077,8 +14087,8 @@ var Capture = class {
|
|
|
14077
14087
|
this.signal = signal;
|
|
14078
14088
|
this.file = void 0;
|
|
14079
14089
|
}
|
|
14080
|
-
enableScratchBuffer(
|
|
14081
|
-
this._scratch4k ??=
|
|
14090
|
+
enableScratchBuffer() {
|
|
14091
|
+
this._scratch4k ??= new Uint8Array(65536);
|
|
14082
14092
|
}
|
|
14083
14093
|
get self() {
|
|
14084
14094
|
return this;
|
|
@@ -15403,6 +15413,7 @@ function publishVariable(state, name2, value) {
|
|
|
15403
15413
|
return;
|
|
15404
15414
|
}
|
|
15405
15415
|
state.variables[name2] = shellValueText(value);
|
|
15416
|
+
writeDynamicVariable(state, name2, shellValueText(value));
|
|
15406
15417
|
}
|
|
15407
15418
|
function tryRestoreVariableSync(state, name2, saved) {
|
|
15408
15419
|
if (typedSavedVariables.has(saved)) return false;
|
|
@@ -16140,11 +16151,6 @@ function hasGlobOrEscape(text3, extglob = false) {
|
|
|
16140
16151
|
return false;
|
|
16141
16152
|
}
|
|
16142
16153
|
var nextProcessSubstitutionId = 0;
|
|
16143
|
-
var defaultRuntimeMuscleMemoryMap;
|
|
16144
|
-
function getRuntimeMuscleMemoryCommand(name2) {
|
|
16145
|
-
defaultRuntimeMuscleMemoryMap ??= new Map([...createStreamFormatCommands(), ...createStreamInspectionCommands(), ...createBcCommands(), ...createSpongeCommands(), ...createFdCommands(), ...createLessCommands(), ...createIdCommands(), ...createWhoamiCommands(), ...createUnameCommands(), ...createHostnameCommands(), ...createNprocCommands(), ...createShufCommands(), ...createDdCommands(), ...createNumfmtCommands(), ...createEnvsubstCommands(), ...createCalCommands(), ...createPathchkCommands(), ...createGetconfCommands(), ...createLocaleCommands(), ...createDfCommands(), ...createSqlite3Commands()].map((cmd) => [cmd.name, cmd]));
|
|
16146
|
-
return defaultRuntimeMuscleMemoryMap.get(name2);
|
|
16147
|
-
}
|
|
16148
16154
|
var fastSubScratchArgs = [];
|
|
16149
16155
|
var defaultValueScopeReserve = ValueScope.prototype.reserve;
|
|
16150
16156
|
var defaultStringCodePointAt = String.prototype.codePointAt;
|
|
@@ -16220,16 +16226,8 @@ var SYNC_UNIT_ZERO = Object.freeze({ exitCode: 0, terminated: false });
|
|
|
16220
16226
|
var SYNC_UNIT_ONE = Object.freeze({ exitCode: 1, terminated: false });
|
|
16221
16227
|
var EMPTY_BYTES = new Uint8Array(0);
|
|
16222
16228
|
var SYNC_PIPE_DONE_RESULT = Object.freeze({ done: true, value: void 0 });
|
|
16223
|
-
var sharedSyncPipeBuf0 = new Uint8Array(65536);
|
|
16224
|
-
var sharedSyncPipeBuf1 = new Uint8Array(65536);
|
|
16225
16229
|
var sharedSyncPipeDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
16226
16230
|
var syncPurePipelineSlotInUse = false;
|
|
16227
|
-
var lastPurePipeAst;
|
|
16228
|
-
var lastPurePipeSrcRefs = /* @__PURE__ */ new WeakSet();
|
|
16229
|
-
var lastPurePipeSlice1 = "";
|
|
16230
|
-
var lastPurePipeRegistry;
|
|
16231
|
-
var lastPurePipeOutBuf = new Uint8Array(256);
|
|
16232
|
-
var lastPurePipeOutLen = 0;
|
|
16233
16231
|
function isSimpleAsciiGrepPattern(pat) {
|
|
16234
16232
|
const start = pat.length >= 2 && pat.charCodeAt(0) === 94 ? 1 : 0;
|
|
16235
16233
|
if (start >= pat.length) return false;
|
|
@@ -17431,6 +17429,8 @@ var Runtime = class _Runtime {
|
|
|
17431
17429
|
if (dereference) name2 = this.referenceName(state, name2);
|
|
17432
17430
|
if (state.readonlyVariables?.has(name2)) throw new PublicDiagnostic(`${name2}: readonly variable`);
|
|
17433
17431
|
delete state.variables[name2];
|
|
17432
|
+
if (name2 === "RANDOM") state.randomDisabled = true;
|
|
17433
|
+
if (name2 === "SECONDS") state.secondsDisabled = true;
|
|
17434
17434
|
state.exported.delete(name2);
|
|
17435
17435
|
state.variableAttributes?.delete(name2);
|
|
17436
17436
|
if (name2 === "OPTIND" && !internal) this.syncGetopts(state);
|
|
@@ -17630,7 +17630,7 @@ var Runtime = class _Runtime {
|
|
|
17630
17630
|
return true;
|
|
17631
17631
|
case "name": {
|
|
17632
17632
|
const effName = resolveSyncNameref(state, tree.name);
|
|
17633
|
-
if (effName === "OPTIND" || effName === "PIPESTATUS") return false;
|
|
17633
|
+
if (effName === "OPTIND" || effName === "PIPESTATUS" || effName === "RANDOM" || effName === "SECONDS") return false;
|
|
17634
17634
|
const monitor = stateMonitor(state);
|
|
17635
17635
|
if (monitor?.hasOverlay(effName) || monitor?.store?.watches.has(effName)) return false;
|
|
17636
17636
|
if (tree.subscript !== void 0) {
|
|
@@ -17714,6 +17714,7 @@ var Runtime = class _Runtime {
|
|
|
17714
17714
|
return true;
|
|
17715
17715
|
}
|
|
17716
17716
|
tryBuildSyncPatternWord(word, rawState, io, diagnosticLine) {
|
|
17717
|
+
if (word.plain !== void 0) return word.plain.startsWith("~") ? void 0 : word.plain;
|
|
17717
17718
|
if (word.parts.length === 0) return void 0;
|
|
17718
17719
|
let out = "";
|
|
17719
17720
|
for (let i = 0; i < word.parts.length; i++) {
|
|
@@ -17876,7 +17877,7 @@ var Runtime = class _Runtime {
|
|
|
17876
17877
|
this.signal.throwIfAborted();
|
|
17877
17878
|
const name2 = typeof key === "string" ? this.referenceName(state, key) : key;
|
|
17878
17879
|
if (arrayStore(state)?.get(String(name2))) throw new ArrayFailure("indexed arithmetic is unsupported");
|
|
17879
|
-
const value = Reflect.get(target, name2) ?? (name2 === "LINENO" ? String(line ?? 1) : name2 === "_" ? state.lastArgument ?? "" : name2 === "FUNCNAME" ? state.functionNames?.[0] : void 0);
|
|
17880
|
+
const value = (typeof name2 === "string" && (name2 === "RANDOM" || name2 === "SECONDS") ? this.variable(state, name2) : Reflect.get(target, name2)) ?? (name2 === "LINENO" ? String(line ?? 1) : name2 === "_" ? state.lastArgument ?? "" : name2 === "FUNCNAME" ? state.functionNames?.[0] : void 0);
|
|
17880
17881
|
if (state.nounset && typeof key === "string" && value === void 0) throw new NounsetFailure(`${key}: unbound variable`, line);
|
|
17881
17882
|
return value;
|
|
17882
17883
|
},
|
|
@@ -17913,6 +17914,7 @@ var Runtime = class _Runtime {
|
|
|
17913
17914
|
}
|
|
17914
17915
|
variable(state, name2) {
|
|
17915
17916
|
name2 = this.referenceName(state, name2);
|
|
17917
|
+
if (name2 === "RANDOM" || name2 === "SECONDS") return readDynamicVariable(stateMonitor(state)?.raw ?? state, name2) ?? state.variables[name2];
|
|
17916
17918
|
const binding = arrayStore(state)?.get(name2);
|
|
17917
17919
|
if (binding) return binding.get(binding.associative ? binding.keys.get("30")?.index ?? -1 : 0);
|
|
17918
17920
|
if (name2 === "DIRSTACK") return state.cwd;
|
|
@@ -18672,7 +18674,9 @@ var Runtime = class _Runtime {
|
|
|
18672
18674
|
if (entry.value.parts.length > 0) {
|
|
18673
18675
|
try {
|
|
18674
18676
|
val = this.fastValueWord(entry.value, rawState, io, false, false, false, false, entry.index === void 0 ? void 0 : 0, diagnosticLine);
|
|
18675
|
-
} catch {
|
|
18677
|
+
} catch (error) {
|
|
18678
|
+
this.signal.throwIfAborted();
|
|
18679
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18676
18680
|
return false;
|
|
18677
18681
|
}
|
|
18678
18682
|
}
|
|
@@ -18742,7 +18746,9 @@ var Runtime = class _Runtime {
|
|
|
18742
18746
|
let unsplit;
|
|
18743
18747
|
try {
|
|
18744
18748
|
unsplit = this.fastValueWord(entry.value, rawState, io, false, false, false, false, void 0, diagnosticLine);
|
|
18745
|
-
} catch {
|
|
18749
|
+
} catch (error) {
|
|
18750
|
+
this.signal.throwIfAborted();
|
|
18751
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18746
18752
|
return false;
|
|
18747
18753
|
}
|
|
18748
18754
|
if (typeof unsplit !== "string" || hasGlobOrEscape(unsplit, !!rawState.extglob)) return false;
|
|
@@ -18763,7 +18769,9 @@ var Runtime = class _Runtime {
|
|
|
18763
18769
|
if (entry.value.parts.length > 0) {
|
|
18764
18770
|
try {
|
|
18765
18771
|
val = this.fastValueWord(entry.value, rawState, io, false, false, false, false, entry.index === void 0 ? void 0 : 0, diagnosticLine);
|
|
18766
|
-
} catch {
|
|
18772
|
+
} catch (error) {
|
|
18773
|
+
this.signal.throwIfAborted();
|
|
18774
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18767
18775
|
return false;
|
|
18768
18776
|
}
|
|
18769
18777
|
}
|
|
@@ -18845,7 +18853,9 @@ var Runtime = class _Runtime {
|
|
|
18845
18853
|
let val;
|
|
18846
18854
|
try {
|
|
18847
18855
|
val = this.fastValueWord(assignment.value, rawState, io, false, false, false, false, 0, diagnosticLine);
|
|
18848
|
-
} catch {
|
|
18856
|
+
} catch (error) {
|
|
18857
|
+
this.signal.throwIfAborted();
|
|
18858
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18849
18859
|
return false;
|
|
18850
18860
|
}
|
|
18851
18861
|
if (typeof val !== "string") return false;
|
|
@@ -18873,7 +18883,9 @@ var Runtime = class _Runtime {
|
|
|
18873
18883
|
keyVal = this.fastValueWord(word, rawState, io, false, false, false, false, void 0, diagnosticLine);
|
|
18874
18884
|
if (typeof keyVal !== "string" || keyVal.length === 0) return false;
|
|
18875
18885
|
val = this.fastValueWord(assignment.value, rawState, io, false, false, false, false, 0, diagnosticLine);
|
|
18876
|
-
} catch {
|
|
18886
|
+
} catch (error) {
|
|
18887
|
+
this.signal.throwIfAborted();
|
|
18888
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18877
18889
|
return false;
|
|
18878
18890
|
}
|
|
18879
18891
|
if (typeof val !== "string") return false;
|
|
@@ -18976,11 +18988,10 @@ var Runtime = class _Runtime {
|
|
|
18976
18988
|
const holding = store.owner.hold();
|
|
18977
18989
|
let staged;
|
|
18978
18990
|
try {
|
|
18979
|
-
|
|
18980
|
-
const current = store.get(name2);
|
|
18991
|
+
let current = store.get(name2);
|
|
18981
18992
|
if (associative !== void 0 && current && current.associative !== associative) throw new ArrayFailure("cannot convert array kind");
|
|
18982
18993
|
const isAssociative = associative ?? current?.associative;
|
|
18983
|
-
|
|
18994
|
+
let initialMaximum = current?.maximum ?? (state.variables[name2] === void 0 ? -1 : 0);
|
|
18984
18995
|
let selectedIndex;
|
|
18985
18996
|
let planned = assignment.append && assignment.kind === "compound" ? initialMaximum + 1 : 0;
|
|
18986
18997
|
if (assignment.kind === "element") {
|
|
@@ -19005,6 +19016,31 @@ var Runtime = class _Runtime {
|
|
|
19005
19016
|
}
|
|
19006
19017
|
await operation2.ledger.checkpoint(this.signal, entry.value.parts.length + 2);
|
|
19007
19018
|
}
|
|
19019
|
+
const expandedEntries = [];
|
|
19020
|
+
let elementFields;
|
|
19021
|
+
if (assignment.kind === "element") {
|
|
19022
|
+
elementFields = await this.valueWord(assignment.value, state, io, false, false, false, false, void 0, false, false, 0);
|
|
19023
|
+
} else for (const entry of assignment.entries) {
|
|
19024
|
+
const original = compoundEntryWords.get(entry);
|
|
19025
|
+
let expandedEntry = false;
|
|
19026
|
+
if (entry.index && original && state.braceexpand !== false && original.parts.some((part) => part.kind === "text" && !part.quoted && part.value.includes("{"))) {
|
|
19027
|
+
for await (const expanded of expandBraces(original, this.budget, this.signal)) {
|
|
19028
|
+
if (expanded === original) break;
|
|
19029
|
+
expandedEntry = true;
|
|
19030
|
+
const fields2 = await this.valueWord(expanded, state, io, true, false, false, false, void 0, false, false);
|
|
19031
|
+
operation2.reserve({ metadata: 32, slots: 1, work: 1 });
|
|
19032
|
+
expandedEntries.push({ entry: { value: expanded }, fields: fields2 });
|
|
19033
|
+
}
|
|
19034
|
+
}
|
|
19035
|
+
if (expandedEntry) continue;
|
|
19036
|
+
const fields = await this.valueWord(entry.value, state, io, entry.index === void 0, false, false, false, void 0, false, entry.index === void 0, entry.index === void 0 ? void 0 : 0);
|
|
19037
|
+
operation2.reserve({ metadata: 32, slots: 1, work: 1 });
|
|
19038
|
+
expandedEntries.push({ entry, fields });
|
|
19039
|
+
}
|
|
19040
|
+
current = store.get(name2);
|
|
19041
|
+
initialMaximum = current?.maximum ?? (state.variables[name2] === void 0 ? -1 : 0);
|
|
19042
|
+
this.assertArrayWritable(state, name2, origin);
|
|
19043
|
+
const watch = await store.watch(name2, operation2, this.signal);
|
|
19008
19044
|
const supersede = await stateMonitor(state).prepareTypedPublication(name2, operation2, this.signal);
|
|
19009
19045
|
await this.prepareArrayObservers(state, operation2);
|
|
19010
19046
|
const tickets = operation2.reserve({ generation: true, version: true, epoch: true, work: 8 });
|
|
@@ -19079,7 +19115,7 @@ var Runtime = class _Runtime {
|
|
|
19079
19115
|
if (stagedKey.pendingKey) pendingKeys.push(stagedKey.pendingKey);
|
|
19080
19116
|
index = stagedKey.index;
|
|
19081
19117
|
} else index = await this.arrayIndex(targetBinding, assignment.index, state, io, operation2, true);
|
|
19082
|
-
const value = await join(
|
|
19118
|
+
const value = await join(elementFields);
|
|
19083
19119
|
if (!current && state.variables[name2] !== void 0 && (index !== 0 || assignment.append)) {
|
|
19084
19120
|
const scalar2 = stateMonitor(state)?.values.get(name2, state.variables[name2]) ?? state.variables[name2];
|
|
19085
19121
|
const token = await valueToken(targetBinding.owner, scalar2, this.signal);
|
|
@@ -19091,23 +19127,8 @@ var Runtime = class _Runtime {
|
|
|
19091
19127
|
}
|
|
19092
19128
|
}
|
|
19093
19129
|
await insert(index, value, assignment.append);
|
|
19094
|
-
} else for (const entry of
|
|
19095
|
-
const original = compoundEntryWords.get(entry);
|
|
19096
|
-
if (entry.index && original && state.braceexpand !== false && original.parts.some((part) => part.kind === "text" && !part.quoted && part.value.includes("{"))) {
|
|
19097
|
-
let expandedEntry = false;
|
|
19098
|
-
for await (const expanded of expandBraces(original, this.budget, this.signal)) {
|
|
19099
|
-
if (expanded === original) break;
|
|
19100
|
-
expandedEntry = true;
|
|
19101
|
-
const values = await this.valueWord(expanded, state, io, true, false, false, false, void 0, false, false);
|
|
19102
|
-
for (const value of values) {
|
|
19103
|
-
await insert(cursor, value);
|
|
19104
|
-
cursor++;
|
|
19105
|
-
}
|
|
19106
|
-
}
|
|
19107
|
-
if (expandedEntry) continue;
|
|
19108
|
-
}
|
|
19130
|
+
} else for (const { entry, fields } of expandedEntries) {
|
|
19109
19131
|
const index = entry.index ? await this.arrayIndex(targetBinding, entry.index, state, io, operation2, true) : void 0;
|
|
19110
|
-
const fields = await this.valueWord(entry.value, state, io, entry.index === void 0, false, false, false, void 0, false, entry.index === void 0, entry.index === void 0 ? void 0 : 0);
|
|
19111
19132
|
if (index !== void 0) {
|
|
19112
19133
|
const value = await join(fields);
|
|
19113
19134
|
await insert(index, value, entry.append);
|
|
@@ -20509,7 +20530,7 @@ var Runtime = class _Runtime {
|
|
|
20509
20530
|
const diagnosticLine = io.diagnosticCommandLines?.get(command) ?? (command.line ?? 1) + (io.diagnosticOffset ?? 0);
|
|
20510
20531
|
if (cSingle !== void 0 && !customRegisteredRegistries.has(this.commands) && !hasShellFunction(rawState, cSingle.w0Plain) && !rawState.extensions?.builtins.has(cSingle.w0Plain) && command.words.length <= this.budget.maxExpansionFieldsSmi && (this.budget.commands + 1 <= this.budget.maxCommandsSmi || this.budget.commands + 1 <= this.budget.limits.maxCommands)) {
|
|
20511
20532
|
w0Plain = cSingle.w0Plain;
|
|
20512
|
-
const extD = this.
|
|
20533
|
+
const extD = this.commands.get(w0Plain);
|
|
20513
20534
|
if (!extD || !builtInDirectContextExecutors.has(extD.execute) || customRegisteredCommands.has(extD.execute)) return void 0;
|
|
20514
20535
|
externalDef = extD;
|
|
20515
20536
|
args = cSingle.args;
|
|
@@ -20527,7 +20548,7 @@ var Runtime = class _Runtime {
|
|
|
20527
20548
|
return void 0;
|
|
20528
20549
|
}
|
|
20529
20550
|
w0Plain = w0P;
|
|
20530
|
-
const extD = this.
|
|
20551
|
+
const extD = this.commands.get(w0Plain);
|
|
20531
20552
|
if (!extD || !builtInDirectContextExecutors.has(extD.execute) || customRegisteredCommands.has(extD.execute) || customRegisteredRegistries.has(this.commands) || command.words.length > this.budget.maxExpansionFieldsSmi || this.budget.commands + 1 > this.budget.maxCommandsSmi && this.budget.commands + 1 > this.budget.limits.maxCommands) {
|
|
20532
20553
|
return void 0;
|
|
20533
20554
|
}
|
|
@@ -20576,13 +20597,11 @@ var Runtime = class _Runtime {
|
|
|
20576
20597
|
let redirectSink;
|
|
20577
20598
|
if (command.redirects.length === 1) {
|
|
20578
20599
|
const r0 = command.redirects[0];
|
|
20579
|
-
let targetVal
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
return void 0;
|
|
20585
|
-
}
|
|
20600
|
+
let targetVal;
|
|
20601
|
+
try {
|
|
20602
|
+
targetVal = this.fastValueWord(r0.target, rawState, io, true, false, false, true, void 0, diagnosticLine);
|
|
20603
|
+
} catch {
|
|
20604
|
+
return void 0;
|
|
20586
20605
|
}
|
|
20587
20606
|
if (typeof targetVal !== "string" || !targetVal || targetVal.includes("\0")) return void 0;
|
|
20588
20607
|
let cachedFile = r0._cachedRedirectFile;
|
|
@@ -20639,25 +20658,6 @@ var Runtime = class _Runtime {
|
|
|
20639
20658
|
if (pipeline.commands.length >= 2 && !existing) {
|
|
20640
20659
|
const n = pipeline.commands.length;
|
|
20641
20660
|
if (this.budget.commands + n > this.budget.maxCommandsSmi && this.budget.commands + n > this.budget.limits.maxCommands) return void 0;
|
|
20642
|
-
if (pipeline === lastPurePipeAst && !syncPurePipelineSlotInUse && this._isMemoryBackingFs && this.backingFs && this.backingFs.capabilitiesFor === void 0 && this.commands === lastPurePipeRegistry && (!rawState.functions || rawState.functions.size === 0) && !rawState.extensions?.builtins.size && io.stdinIsDefault && !this.signal.aborted && !hasYieldCheckpoint(this.signal) && this.budget.canSyncPurePipe && Date.now === defaultDateNow && io.stdout instanceof Capture && io.stdout._scratch4k !== void 0 && io.stdout.length === 0 && io.stdout.write === Capture.prototype.write && io.stderr instanceof Capture && io.stderr.length === 0 && io.stderr.write === Capture.prototype.write) {
|
|
20643
|
-
const rootEntry = this.backingFs.root?.entries?.get(lastPurePipeSlice1);
|
|
20644
|
-
if (rootEntry && rootEntry.type === "file" && rootEntry.revision === 0 && rootEntry.mode !== void 0 && (rootEntry.mode >> 6 & 4) === 4 && rootEntry.sourceRef && lastPurePipeSrcRefs.has(rootEntry.sourceRef)) {
|
|
20645
|
-
this.budget.enterPipelineStages(n);
|
|
20646
|
-
this.budget.commands += n;
|
|
20647
|
-
try {
|
|
20648
|
-
this.budget.fileSystemOperation();
|
|
20649
|
-
io.stdout.writeRangeSync(lastPurePipeOutBuf, lastPurePipeOutLen);
|
|
20650
|
-
} finally {
|
|
20651
|
-
this.budget.leavePipelineStages(n);
|
|
20652
|
-
}
|
|
20653
|
-
const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
|
|
20654
|
-
monitor.lazyPipeStatus = ZERO_PIPE_STATUSES[n];
|
|
20655
|
-
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
20656
|
-
rawState.status = 0;
|
|
20657
|
-
monitor.epoch = restEpoch;
|
|
20658
|
-
return SYNC_UNIT_ZERO;
|
|
20659
|
-
}
|
|
20660
|
-
}
|
|
20661
20661
|
for (let i = 0; i < n; i++) {
|
|
20662
20662
|
const cmd = pipeline.commands[i];
|
|
20663
20663
|
if (cmd.kind !== "simple" || !this.isPureExternalStageCommand(cmd, rawState) || cmd.words.length > this.budget.maxExpansionFieldsSmi) return void 0;
|
|
@@ -20766,11 +20766,10 @@ var Runtime = class _Runtime {
|
|
|
20766
20766
|
return void 0;
|
|
20767
20767
|
}
|
|
20768
20768
|
const n = pipeline.commands.length;
|
|
20769
|
-
let firstStageRootSourceRef;
|
|
20770
20769
|
for (let i = 0; i < n; i++) {
|
|
20771
20770
|
const cmd = pipeline.commands[i];
|
|
20772
20771
|
const name2 = cmd.words[0].plain;
|
|
20773
|
-
const extDef = this.
|
|
20772
|
+
const extDef = this.commands.get(name2);
|
|
20774
20773
|
if (!extDef || !builtInDirectContextExecutors.has(extDef.execute) || customRegisteredCommands.has(extDef.execute)) {
|
|
20775
20774
|
return void 0;
|
|
20776
20775
|
}
|
|
@@ -20794,7 +20793,6 @@ var Runtime = class _Runtime {
|
|
|
20794
20793
|
const slice1 = cmd._cachedSlice1 ?? (cmd._cachedSlice1 = fileArg.slice(1));
|
|
20795
20794
|
const rootEntry = backing.root?.entries?.get(slice1);
|
|
20796
20795
|
if (!rootEntry || rootEntry.type !== "file" || rootEntry.data && rootEntry.data.byteLength > 65536) return void 0;
|
|
20797
|
-
if (rootEntry.revision === 0 && rootEntry.mode !== void 0 && (rootEntry.mode >> 6 & 4) === 4 && rootEntry.data && rootEntry.data.byteLength >= 1024) firstStageRootSourceRef = rootEntry.sourceRef;
|
|
20798
20796
|
}
|
|
20799
20797
|
} else if (name2 === "find") {
|
|
20800
20798
|
if (stageArgs.length !== 3 || stageArgs[1] !== "-name" || stageArgs[0].startsWith("-") || stageArgs[0].startsWith("/dev")) return void 0;
|
|
@@ -20820,22 +20818,8 @@ var Runtime = class _Runtime {
|
|
|
20820
20818
|
} else return void 0;
|
|
20821
20819
|
}
|
|
20822
20820
|
}
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
this.budget.commands += n;
|
|
20826
|
-
try {
|
|
20827
|
-
this.budget.fileSystemOperation();
|
|
20828
|
-
io.stdout.writeRangeSync(lastPurePipeOutBuf, lastPurePipeOutLen);
|
|
20829
|
-
} finally {
|
|
20830
|
-
this.budget.leavePipelineStages(n);
|
|
20831
|
-
}
|
|
20832
|
-
const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
|
|
20833
|
-
monitor.lazyPipeStatus = ZERO_PIPE_STATUSES[n] ?? new Array(n).fill(0);
|
|
20834
|
-
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
20835
|
-
rawState.status = 0;
|
|
20836
|
-
monitor.epoch = restEpoch;
|
|
20837
|
-
return SYNC_UNIT_ZERO;
|
|
20838
|
-
}
|
|
20821
|
+
const sharedSyncPipeBuf0 = new Uint8Array(65536);
|
|
20822
|
+
const sharedSyncPipeBuf1 = new Uint8Array(65536);
|
|
20839
20823
|
syncPurePipelineSlotInUse = true;
|
|
20840
20824
|
this.budget.enterPipelineStages(n);
|
|
20841
20825
|
this.budget.commands += n;
|
|
@@ -20846,7 +20830,7 @@ var Runtime = class _Runtime {
|
|
|
20846
20830
|
for (let index = start; index < n; index++) {
|
|
20847
20831
|
const cmd = pipeline.commands[index];
|
|
20848
20832
|
const firstName = cmd.words[0].plain;
|
|
20849
|
-
const extDef = this.
|
|
20833
|
+
const extDef = this.commands.get(firstName);
|
|
20850
20834
|
const stageArgs = cmd._cachedPlainArgs;
|
|
20851
20835
|
const isFirst = index === 0;
|
|
20852
20836
|
const isLast = index === n - 1;
|
|
@@ -20911,21 +20895,7 @@ var Runtime = class _Runtime {
|
|
|
20911
20895
|
syncPurePipelineSlotInUse = false;
|
|
20912
20896
|
this.budget.leavePipelineStages(n);
|
|
20913
20897
|
};
|
|
20914
|
-
const stdout = io.stdout;
|
|
20915
|
-
const stderr = io.stderr;
|
|
20916
20898
|
const finish = () => {
|
|
20917
|
-
if (n >= 3 && !pipeline.negate && statuses === void 0 && firstStageRootSourceRef !== void 0 && stderr.length === 0 && stdout.length <= 256 && Date.now === defaultDateNow) {
|
|
20918
|
-
const scratch = stdout._scratch4k;
|
|
20919
|
-
if (scratch) {
|
|
20920
|
-
const outLen = stdout.length;
|
|
20921
|
-
for (let bi = 0; bi < outLen; bi++) lastPurePipeOutBuf[bi] = scratch[bi];
|
|
20922
|
-
lastPurePipeOutLen = outLen;
|
|
20923
|
-
lastPurePipeAst = pipeline;
|
|
20924
|
-
lastPurePipeSlice1 = pipeline.commands[0]._cachedSlice1 ?? "";
|
|
20925
|
-
lastPurePipeRegistry = this.commands;
|
|
20926
|
-
lastPurePipeSrcRefs.add(firstStageRootSourceRef);
|
|
20927
|
-
}
|
|
20928
|
-
}
|
|
20929
20899
|
const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
|
|
20930
20900
|
const finalStatuses = statuses ?? ZERO_PIPE_STATUSES[n] ?? new Array(n).fill(0);
|
|
20931
20901
|
monitor.lazyPipeStatus = finalStatuses;
|
|
@@ -20981,7 +20951,7 @@ var Runtime = class _Runtime {
|
|
|
20981
20951
|
for (let index = 0; index < n; index++) {
|
|
20982
20952
|
const cmd = pipeline.commands[index];
|
|
20983
20953
|
const firstName = cmd.words[0].plain;
|
|
20984
|
-
const extDef = this.
|
|
20954
|
+
const extDef = this.commands.get(firstName);
|
|
20985
20955
|
let stageArgs = cmd._cachedPlainArgs;
|
|
20986
20956
|
if (!stageArgs) {
|
|
20987
20957
|
stageArgs = new Array(cmd.words.length - 1);
|
|
@@ -21966,7 +21936,7 @@ var Runtime = class _Runtime {
|
|
|
21966
21936
|
}
|
|
21967
21937
|
canSyncConditional(expr, depth = 0, rawState, requireTotal = false) {
|
|
21968
21938
|
if (depth > 8) return false;
|
|
21969
|
-
if (requireTotal && (expr.kind === "unary" && syncConditionalFileUnaryOps.has(expr.operator) || expr.kind === "binary" && expr.operator !== "==" && expr.operator !== "=" && expr.operator !== "!=" && expr.operator !== "=~")) return false;
|
|
21939
|
+
if (requireTotal && (expr.kind === "unary" && (expr.operator === "-v" || syncConditionalFileUnaryOps.has(expr.operator)) || expr.kind === "binary" && expr.operator !== "==" && expr.operator !== "=" && expr.operator !== "!=" && expr.operator !== "=~")) return false;
|
|
21970
21940
|
const okWord = (w) => !_Runtime.wordMayMutate(w) || rawState !== void 0 && this.isPureSyncValueWord(w, rawState);
|
|
21971
21941
|
if (expr.kind === "nonempty") return okWord(expr.operand);
|
|
21972
21942
|
if (expr.kind === "unary") return (expr.operator === "-n" || expr.operator === "-z" || expr.operator === "-v" || syncConditionalFileUnaryOps.has(expr.operator)) && okWord(expr.operand);
|
|
@@ -22440,7 +22410,7 @@ var Runtime = class _Runtime {
|
|
|
22440
22410
|
const rhsOp = scalarMutMatch[4];
|
|
22441
22411
|
const rhs2 = scalarMutMatch[5] !== void 0 ? Number(scalarMutMatch[5]) : 0;
|
|
22442
22412
|
const rhsNum = rhsOp === "+" ? rhs1 + rhs2 : rhsOp === "-" ? rhs1 - rhs2 : rhsOp === "*" ? rhs1 * rhs2 : rhs1;
|
|
22443
|
-
if (varName
|
|
22413
|
+
if (!controlNames.has(varName) && varName !== "PIPESTATUS" && !store?.get(varName) && !hasNonNamerefAttributes(rawState)) {
|
|
22444
22414
|
const curVal = this._syncArithRawWriteOnly && this._syncArithTouched?.has(varName) ? rawState.variables[varName] ?? "0" : monitor.values.get(varName, rawState.variables[varName] ?? "0") ?? rawState.variables[varName] ?? "0";
|
|
22445
22415
|
if (typeof curVal === "string" && (curVal === "" || /^-?(?:0|[1-9][0-9]{0,12})$/.test(curVal))) {
|
|
22446
22416
|
const curNum = curVal === "" ? 0 : Number(curVal);
|
|
@@ -22658,7 +22628,7 @@ var Runtime = class _Runtime {
|
|
|
22658
22628
|
const clause = command.clauses[cIdx];
|
|
22659
22629
|
for (let pIdx = 0; pIdx < clause.patterns.length; pIdx++) {
|
|
22660
22630
|
const pw = clause.patterns[pIdx];
|
|
22661
|
-
const pStr =
|
|
22631
|
+
const pStr = this.tryBuildSyncPatternWord(pw, rawState, io, diagnosticLine);
|
|
22662
22632
|
if (pStr === void 0) return void 0;
|
|
22663
22633
|
const matched = tryMatchesPatternSync(pStr, fastSubject, work, false, false);
|
|
22664
22634
|
if (matched === void 0) return void 0;
|
|
@@ -24078,7 +24048,7 @@ var Runtime = class _Runtime {
|
|
|
24078
24048
|
}
|
|
24079
24049
|
allArrOk = false;
|
|
24080
24050
|
break;
|
|
24081
|
-
} else if (rawState.locals.length === 0 && isShellIdentifier(tExpanded) && !tExpanded.startsWith("-") && !rawState.readonlyVariables?.has(tExpanded) && !arrStore.get(tExpanded) && !rawState.functions.has(tExpanded) && !monitor.hasOverlay(tExpanded) && tExpanded
|
|
24051
|
+
} else if (rawState.locals.length === 0 && isShellIdentifier(tExpanded) && !tExpanded.startsWith("-") && !rawState.readonlyVariables?.has(tExpanded) && !arrStore.get(tExpanded) && !rawState.functions.has(tExpanded) && !monitor.hasOverlay(tExpanded) && !controlNames.has(tExpanded) && tExpanded !== "PIPESTATUS" && tExpanded !== "_") {
|
|
24082
24052
|
ops.push({ kind: "scalar", targetName: tExpanded });
|
|
24083
24053
|
continue;
|
|
24084
24054
|
} else {
|
|
@@ -24142,7 +24112,7 @@ var Runtime = class _Runtime {
|
|
|
24142
24112
|
for (let ui = uStart; ui < command.words.length; ui++) {
|
|
24143
24113
|
const targetName = command.words[ui].plain;
|
|
24144
24114
|
const existingTargetArr = targetName ? store?.get(targetName) : void 0;
|
|
24145
|
-
if (targetName && isShellIdentifier(targetName) && !targetName.startsWith("-") && !rawState.readonlyVariables?.has(targetName) && (!existingTargetArr || existingTargetArr.references === 1 && !store.watches.has(targetName) && !hasUnpreparedLocal(rawState, targetName)) && !rawState.functions.has(targetName) && !monitor.hasOverlay(targetName) && targetName
|
|
24115
|
+
if (targetName && isShellIdentifier(targetName) && !targetName.startsWith("-") && !rawState.readonlyVariables?.has(targetName) && (!existingTargetArr || existingTargetArr.references === 1 && !store.watches.has(targetName) && !hasUnpreparedLocal(rawState, targetName)) && !rawState.functions.has(targetName) && !monitor.hasOverlay(targetName) && !controlNames.has(targetName) && targetName !== "PIPESTATUS" && targetName !== "_") {
|
|
24146
24116
|
targets.push(targetName);
|
|
24147
24117
|
} else {
|
|
24148
24118
|
allOk = false;
|
|
@@ -25420,7 +25390,7 @@ var Runtime = class _Runtime {
|
|
|
25420
25390
|
continue;
|
|
25421
25391
|
}
|
|
25422
25392
|
if (part.kind === "variable") {
|
|
25423
|
-
if (stateMonitor(rawState)?.store?.get(part.name)) return false;
|
|
25393
|
+
if (part.name === "RANDOM" || part.name === "SECONDS" || stateMonitor(rawState)?.store?.get(part.name)) return false;
|
|
25424
25394
|
if (this._syncLoopFnCheckDepth > 0 && (part.substring || getArraySelector(part)?.kind === "element")) return false;
|
|
25425
25395
|
if (part.prefixNames !== void 0) {
|
|
25426
25396
|
if (part.prefixNames === "@") return false;
|
|
@@ -25489,78 +25459,7 @@ var Runtime = class _Runtime {
|
|
|
25489
25459
|
if (part.kind === "substitution") {
|
|
25490
25460
|
if (this._syncLoopFnCheckDepth > 0) return false;
|
|
25491
25461
|
if (this.tryAdmitLoopInvariantSubstitution(part, rawState)) continue;
|
|
25492
|
-
|
|
25493
|
-
if (part.script.lists.length !== 1) return false;
|
|
25494
|
-
const list = part.script.lists[0];
|
|
25495
|
-
if (list.terminator || list.pipelines.length !== 1) return false;
|
|
25496
|
-
const p = list.pipelines[0];
|
|
25497
|
-
if (p.negate || p.commands.length !== 1) return false;
|
|
25498
|
-
let cmd = p.commands[0];
|
|
25499
|
-
if (cmd.kind === "for" || cmd.kind === "arithmetic-for" || cmd.kind === "while") return false;
|
|
25500
|
-
if (p.commands.length === 1 && (cmd.kind === "if" || cmd.kind === "case") && this.isPureSyncSubIfOrCase(cmd, rawState)) {
|
|
25501
|
-
continue;
|
|
25502
|
-
}
|
|
25503
|
-
if (cmd.kind !== "simple" || cmd.redirects.length > 0 || cmd.words.length === 0) return false;
|
|
25504
|
-
let w0Plain = cmd.words[0].plain;
|
|
25505
|
-
if (p.commands.length === 1 && w0Plain !== void 0 && rawState.functions.has(w0Plain) && this.firstInternalDiscovery(w0Plain, rawState, false) === "function" && !rawState.extensions?.builtins.has(w0Plain)) {
|
|
25506
|
-
const fnBody = rawState.functions.get(w0Plain);
|
|
25507
|
-
if (fnBody.kind === "group" && fnBody.redirects.length === 0 && fnBody.body.lists.length === 1 && !fnBody.body.lists[0].terminator && fnBody.body.lists[0].pipelines.length === 1 && !fnBody.body.lists[0].pipelines[0].negate && fnBody.body.lists[0].pipelines[0].commands.length === 1 && fnBody.body.lists[0].pipelines[0].commands[0].kind === "simple" && fnBody.body.lists[0].pipelines[0].commands[0].redirects.length === 0 && cmd.words.slice(1).every((w) => this.isPureArgWord(w, rawState) && this.isPureSyncValueWord(w, rawState) && w.parts.length > 0 && w.parts.every(
|
|
25508
|
-
(part2) => part2.quoted || part2.kind === "text" && part2.value.length > 0 && !part2.value.includes(" ") && !part2.value.includes(" ") && !part2.value.includes("\n") && !part2.value.includes("{") && !hasGlobOrEscape(part2.value, true)
|
|
25509
|
-
))) {
|
|
25510
|
-
const innerCmd = fnBody.body.lists[0].pipelines[0].commands[0];
|
|
25511
|
-
const innerW0 = innerCmd.words[0]?.plain;
|
|
25512
|
-
if (innerW0 && (innerW0 === "echo" || innerW0 === "printf" || innerW0 === "dirname" || innerW0 === "basename" || innerW0 === "pwd" || innerW0 === "command" || innerW0 === "type" || innerW0 === "seq") && !rawState.functions.has(innerW0) && !rawState.extensions?.builtins.has(innerW0)) {
|
|
25513
|
-
cmd = innerCmd;
|
|
25514
|
-
w0Plain = innerW0;
|
|
25515
|
-
}
|
|
25516
|
-
}
|
|
25517
|
-
}
|
|
25518
|
-
if (w0Plain === "tac" || w0Plain === "nl" || w0Plain === "base64" && cmd.words.length > 1) return false;
|
|
25519
|
-
if (w0Plain === "pwd") {
|
|
25520
|
-
if (p.commands.length === 1 && (cmd.words.length === 1 || cmd.words.length === 2 && (cmd.words[1]?.plain === "-L" || cmd.words[1]?.plain === "--logical")) && !rawState.functions.has("pwd") && !rawState.extensions?.builtins.has("pwd")) continue;
|
|
25521
|
-
return false;
|
|
25522
|
-
}
|
|
25523
|
-
if (w0Plain === "command" && cmd.words[1]?.plain === "-v" || w0Plain === "type" && cmd.words[1]?.plain === "-t") {
|
|
25524
|
-
return false;
|
|
25525
|
-
}
|
|
25526
|
-
const def = w0Plain ? w0Plain === "seq" ? this.getExternalCommand(w0Plain) : this.commands.get(w0Plain) : void 0;
|
|
25527
|
-
if (!w0Plain || w0Plain !== "printf" && w0Plain !== "echo" && w0Plain !== "dirname" && w0Plain !== "basename" && w0Plain !== "seq" || !def || rawState.functions.has(w0Plain) || rawState.extensions?.builtins.has(w0Plain)) return false;
|
|
25528
|
-
if (w0Plain === "printf" ? def.execute !== printfCommand.execute : w0Plain === "echo" ? !defaultEchoExecutors.has(def.execute) : w0Plain === "seq" ? !builtInDirectContextExecutors.has(def.execute) && customRegisteredCommands.has(def.execute) : !builtInDirectContextExecutors.has(def.execute)) return false;
|
|
25529
|
-
if (!cmd.words.slice(1).every((w) => this.isPureArgWord(w, rawState) && this.isPureSyncValueWord(w, rawState))) return false;
|
|
25530
|
-
if ((w0Plain === "echo" || w0Plain === "basename" || w0Plain === "dirname") && !cmd.words.slice(1).every((w) => w.parts.length > 0 && w.parts.every(
|
|
25531
|
-
(part2) => part2.quoted || part2.kind === "text" && part2.value.length > 0 && !part2.value.includes(" ") && !part2.value.includes(" ") && !part2.value.includes("\n") && !part2.value.includes("{") && !hasGlobOrEscape(part2.value, true)
|
|
25532
|
-
))) return false;
|
|
25533
|
-
if (w0Plain === "printf") {
|
|
25534
|
-
if (!this.isSyncPrintfCallOk(cmd, 1, rawState, this._activePrintfInductionName)) return false;
|
|
25535
|
-
} else if (w0Plain === "echo") {
|
|
25536
|
-
if (!this.isSyncSubEchoCallOk(cmd, rawState)) return false;
|
|
25537
|
-
} else if (w0Plain === "dirname" || w0Plain === "basename") {
|
|
25538
|
-
const simArgs = [];
|
|
25539
|
-
let seenDoubleDash = false;
|
|
25540
|
-
for (let wi = 1; wi < cmd.words.length; wi++) {
|
|
25541
|
-
const w = cmd.words[wi];
|
|
25542
|
-
if (w.parts[0]?.kind === "text" && !w.parts[0].quoted && w.parts[0].value.startsWith("~")) return false;
|
|
25543
|
-
const st = w.plain ?? (w.parts.length > 0 && w.parts.every((pt) => pt.kind === "text") ? w.parts.map((pt) => pt.value).join("") : void 0);
|
|
25544
|
-
if (st !== void 0) {
|
|
25545
|
-
if (st === "--") seenDoubleDash = true;
|
|
25546
|
-
simArgs.push(st);
|
|
25547
|
-
} else {
|
|
25548
|
-
if (!seenDoubleDash) return false;
|
|
25549
|
-
simArgs.push("x");
|
|
25550
|
-
}
|
|
25551
|
-
}
|
|
25552
|
-
if ((w0Plain === "dirname" ? this.evalSyncDirname(simArgs) : this.evalSyncBasename(simArgs)) === void 0) return false;
|
|
25553
|
-
} else if (w0Plain === "seq") {
|
|
25554
|
-
const simArgs = [];
|
|
25555
|
-
for (let wi = 1; wi < cmd.words.length; wi++) {
|
|
25556
|
-
const w = cmd.words[wi];
|
|
25557
|
-
const st = w.plain ?? (w.parts.length > 0 && w.parts.every((pt) => pt.kind === "text") ? w.parts.map((pt) => pt.value).join("") : void 0);
|
|
25558
|
-
if (st === void 0) return false;
|
|
25559
|
-
simArgs.push(st);
|
|
25560
|
-
}
|
|
25561
|
-
if (this.evalSyncSeq(simArgs) === void 0) return false;
|
|
25562
|
-
}
|
|
25563
|
-
continue;
|
|
25462
|
+
return false;
|
|
25564
25463
|
}
|
|
25565
25464
|
return false;
|
|
25566
25465
|
}
|
|
@@ -25612,7 +25511,7 @@ var Runtime = class _Runtime {
|
|
|
25612
25511
|
};
|
|
25613
25512
|
return preservesInteger(script);
|
|
25614
25513
|
};
|
|
25615
|
-
const safeArgWord = (w, numeric2 = false) => (!checkIntVars || this.isPureSyncValueWord(w, rawState)) && (w.parts.every((p) => p.quoted || p.kind === "text" && p.value.length > 0 && !p.value.includes(" ") && !p.value.includes(" ") && !p.value.includes("\n") && !p.value.includes("{") && !hasGlobOrEscape(p.value, true)) || numeric2 && (!checkIntVars && w.parts.length === 1 && w.parts[0].kind === "variable" || checkIntVars && rawState.variables.IFS === void 0 && isGuaranteedIntWord(w)));
|
|
25514
|
+
const safeArgWord = (w, numeric2 = false) => (!checkIntVars || this.isPureSyncValueWord(w, rawState)) && (w.parts.every((p) => p.quoted || p.kind === "text" && p.value.length > 0 && !p.value.includes(" ") && !p.value.includes(" ") && !p.value.includes("\n") && !p.value.includes("{") && !hasGlobOrEscape(p.value, true)) || numeric2 && (!checkIntVars && w.parts.length === 1 && w.parts[0].kind === "variable" || checkIntVars && (rawState.variables.IFS === void 0 || rawState.variables.IFS === " \n") && isGuaranteedIntWord(w)));
|
|
25616
25515
|
if (args.length === 2) {
|
|
25617
25516
|
const op = args[0].plain;
|
|
25618
25517
|
if ((op === "-n" || op === "-z") && safeArgWord(args[1])) {
|
|
@@ -25987,7 +25886,7 @@ var Runtime = class _Runtime {
|
|
|
25987
25886
|
const work = { remaining: 4096, signal: this.signal, exhausted: () => this.budget.fail("maxExpansionBytes") };
|
|
25988
25887
|
for (const cl of cmd.clauses) {
|
|
25989
25888
|
if (cl.terminator !== ";;" && cl.terminator !== "esac") return false;
|
|
25990
|
-
if (!cl.patterns.every((pw) => pw.plain !== void 0 && tryMatchesPatternSync(pw.plain, "", work, false, false) !== void 0)) return false;
|
|
25889
|
+
if (!cl.patterns.every((pw) => pw.plain !== void 0 && !pw.plain.startsWith("~") && tryMatchesPatternSync(pw.plain, "", work, false, false) !== void 0)) return false;
|
|
25991
25890
|
if (!isSimpleEchoOrPrintf(cl.body)) return false;
|
|
25992
25891
|
}
|
|
25993
25892
|
return true;
|
|
@@ -26072,7 +25971,7 @@ var Runtime = class _Runtime {
|
|
|
26072
25971
|
if (!cl.patterns.every((pw) => {
|
|
26073
25972
|
if (!pw.parts.every((p2) => p2.kind === "text")) return false;
|
|
26074
25973
|
if (pw.plain === void 0 && !pw.parts.every((p2) => p2.quoted)) return false;
|
|
26075
|
-
const pattern =
|
|
25974
|
+
const pattern = io ? this.tryBuildSyncPatternWord(pw, rawState, io) : pw.plain?.startsWith("~") ? void 0 : pw.plain;
|
|
26076
25975
|
return pattern !== void 0 && tryMatchesPatternSync(pattern, "", work, false, false) !== void 0;
|
|
26077
25976
|
})) {
|
|
26078
25977
|
caseOk = false;
|
|
@@ -26604,7 +26503,7 @@ var Runtime = class _Runtime {
|
|
|
26604
26503
|
for (let b = 0; b + 1 < bodyAssignments.length; b++) {
|
|
26605
26504
|
const curr = bodyAssignments[b];
|
|
26606
26505
|
const next = bodyAssignments[b + 1];
|
|
26607
|
-
if (curr.targetWord !== void 0 && curr.value !== void 0 && this.isSimpleRedirectEchoWord(curr.value) && !curr.append && next.targetWord !== void 0 && next.value !== void 0 && this.isSimpleRedirectEchoWord(next.value) && next.append && sameRedirectTargetWord(curr.targetWord, next.targetWord)) {
|
|
26506
|
+
if (curr.listOperator === void 0 && next.listOperator === void 0 && curr.targetWord !== void 0 && curr.value !== void 0 && this.isSimpleRedirectEchoWord(curr.value) && !curr.append && next.targetWord !== void 0 && next.value !== void 0 && this.isSimpleRedirectEchoWord(next.value) && next.append && sameRedirectTargetWord(curr.targetWord, next.targetWord) && [next.value, next.targetWord].every((word) => word.parts.every((part) => part.kind !== "variable" || part.name !== "?"))) {
|
|
26608
26507
|
curr.coalesceNext = true;
|
|
26609
26508
|
b++;
|
|
26610
26509
|
}
|
|
@@ -26668,19 +26567,28 @@ var Runtime = class _Runtime {
|
|
|
26668
26567
|
return void 0;
|
|
26669
26568
|
}
|
|
26670
26569
|
const regNames = forPlan.regNames;
|
|
26570
|
+
for (const refName of regNames) {
|
|
26571
|
+
if (store?.get(refName) || store?.watches.has(refName) || monitor.hasOverlay(refName) || rawState.variableAttributes?.has(refName)) return void 0;
|
|
26572
|
+
}
|
|
26573
|
+
const intBudgetSnapshot = this.budget.parsing.snapshot();
|
|
26671
26574
|
for (let r = 0; r < regNames.length; r++) {
|
|
26672
26575
|
const refName = regNames[r];
|
|
26673
|
-
if (store?.get(refName)) return void 0;
|
|
26674
26576
|
if (r > 0) {
|
|
26675
26577
|
const parsed = fastSafeInt(rawState.variables[refName], this.budget.parsing);
|
|
26676
|
-
if (parsed === void 0)
|
|
26578
|
+
if (parsed === void 0) {
|
|
26579
|
+
this.budget.parsing.restore(intBudgetSnapshot);
|
|
26580
|
+
return void 0;
|
|
26581
|
+
}
|
|
26677
26582
|
sharedLoopIntRegs[r] = parsed | 0;
|
|
26678
26583
|
}
|
|
26679
26584
|
}
|
|
26585
|
+
const { ok } = runIntForLoop(fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
26586
|
+
if (!ok) {
|
|
26587
|
+
this.budget.parsing.restore(intBudgetSnapshot);
|
|
26588
|
+
return void 0;
|
|
26589
|
+
}
|
|
26680
26590
|
monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets);
|
|
26681
26591
|
this.budget.tick();
|
|
26682
|
-
const { ok } = runIntForLoop(fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
26683
|
-
if (!ok) return void 0;
|
|
26684
26592
|
this.budget.iterations += wordCount;
|
|
26685
26593
|
this.budget.commands += wordCount * forPlan.bodyStepCount;
|
|
26686
26594
|
for (let r = 0; r < regNames.length; r++) {
|
|
@@ -26811,6 +26719,7 @@ var Runtime = class _Runtime {
|
|
|
26811
26719
|
touched.clear();
|
|
26812
26720
|
let lastCmd;
|
|
26813
26721
|
let lastArg = "";
|
|
26722
|
+
let lastPipelineStatus;
|
|
26814
26723
|
const mode = 438 & ~(rawState.umask ?? 18);
|
|
26815
26724
|
if (command.kind === "arithmetic-for") {
|
|
26816
26725
|
let plan = command._cachedArithPlan;
|
|
@@ -27116,6 +27025,7 @@ var Runtime = class _Runtime {
|
|
|
27116
27025
|
if (!ok) canUseIntRegisters = false;
|
|
27117
27026
|
else {
|
|
27118
27027
|
usedFastIntPath = true;
|
|
27028
|
+
if (iterations > 0) lastPipelineStatus = 0;
|
|
27119
27029
|
this.budget.parsing.admit(limitVal < 0 ? 4 : 2);
|
|
27120
27030
|
this.budget.iterations += iterations + 1;
|
|
27121
27031
|
this.budget.commands += iterations * bodyAssignments.length + subCount;
|
|
@@ -27143,6 +27053,7 @@ var Runtime = class _Runtime {
|
|
|
27143
27053
|
loopStatus2 = rawState.status;
|
|
27144
27054
|
lastCmd = fb.lastCmd;
|
|
27145
27055
|
lastArg = fb.lastArg;
|
|
27056
|
+
lastPipelineStatus = fb.pipelineStatus;
|
|
27146
27057
|
lastInductionVal = fb.lastInductionVal;
|
|
27147
27058
|
} finally {
|
|
27148
27059
|
this._syncReturnDepth--;
|
|
@@ -27207,11 +27118,13 @@ var Runtime = class _Runtime {
|
|
|
27207
27118
|
if (rawState.variables._ !== void 0 && !touched.has("_") && !(usedFastIntPath && touchedIntNamesList.includes("_"))) delete rawState.variables._;
|
|
27208
27119
|
rawState.lastArgument = lastArg;
|
|
27209
27120
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
27121
|
+
}
|
|
27122
|
+
if (lastPipelineStatus !== void 0) {
|
|
27210
27123
|
if (!existing) {
|
|
27211
|
-
monitor.lazyPipeStatus =
|
|
27124
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27212
27125
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27213
27126
|
} else {
|
|
27214
|
-
this.setSyncPipeStatusCell(existing, String(
|
|
27127
|
+
this.setSyncPipeStatusCell(existing, String(lastPipelineStatus));
|
|
27215
27128
|
store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
|
|
27216
27129
|
}
|
|
27217
27130
|
}
|
|
@@ -27226,6 +27139,7 @@ var Runtime = class _Runtime {
|
|
|
27226
27139
|
const cp = command.condition.lists[0].pipelines[0];
|
|
27227
27140
|
if (cp.negate || cp.commands.length !== 1) return void 0;
|
|
27228
27141
|
const condCmd = cp.commands[0];
|
|
27142
|
+
if (condCmd.kind !== "simple" && condCmd.kind !== "arithmetic" && condCmd.kind !== "conditional") return void 0;
|
|
27229
27143
|
let whileArithProg;
|
|
27230
27144
|
let whileCondExpr;
|
|
27231
27145
|
let whileReadSpec;
|
|
@@ -27375,6 +27289,7 @@ var Runtime = class _Runtime {
|
|
|
27375
27289
|
this._syncArithTouched = touched;
|
|
27376
27290
|
const condLine = io.diagnosticCommandLines?.get(condCmd) ?? (condCmd.line ?? diagnosticLine) + (io.diagnosticOffset ?? 0);
|
|
27377
27291
|
let loopStatus2 = 0;
|
|
27292
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
27378
27293
|
let iterCount = 0;
|
|
27379
27294
|
try {
|
|
27380
27295
|
if (whileReadSpec !== void 0 && syncReadInputText !== void 0) {
|
|
@@ -27430,8 +27345,9 @@ var Runtime = class _Runtime {
|
|
|
27430
27345
|
rawState.variables[vn] = "";
|
|
27431
27346
|
touched.add(vn);
|
|
27432
27347
|
}
|
|
27433
|
-
lastCmd = rCmd;
|
|
27434
|
-
lastArg = rLastArg;
|
|
27348
|
+
progress.lastCmd = rCmd;
|
|
27349
|
+
progress.lastArg = rLastArg;
|
|
27350
|
+
progress.pipelineStatus = 1;
|
|
27435
27351
|
break;
|
|
27436
27352
|
}
|
|
27437
27353
|
const nlIdx = syncReadInputText.indexOf(readDelim, cursor);
|
|
@@ -27439,21 +27355,22 @@ var Runtime = class _Runtime {
|
|
|
27439
27355
|
const partialLine = syncReadInputText.slice(cursor);
|
|
27440
27356
|
cursor = textLen;
|
|
27441
27357
|
splitSyncReadLine(partialLine, readIfs);
|
|
27442
|
-
lastCmd = rCmd;
|
|
27443
|
-
lastArg = rLastArg;
|
|
27358
|
+
progress.lastCmd = rCmd;
|
|
27359
|
+
progress.lastArg = rLastArg;
|
|
27360
|
+
progress.pipelineStatus = 1;
|
|
27444
27361
|
break;
|
|
27445
27362
|
}
|
|
27446
27363
|
const lineStr = syncReadInputText.slice(cursor, nlIdx);
|
|
27447
27364
|
cursor = nlIdx + 1;
|
|
27448
27365
|
splitSyncReadLine(lineStr, readIfs);
|
|
27366
|
+
progress.lastCmd = rCmd;
|
|
27367
|
+
progress.lastArg = rLastArg;
|
|
27368
|
+
progress.pipelineStatus = 0;
|
|
27449
27369
|
rawState.status = 0;
|
|
27450
27370
|
++iterCount;
|
|
27451
27371
|
this.budget.loop();
|
|
27452
27372
|
if ((iterCount & 127) === 0) runYieldCheckpoint(this.signal);
|
|
27453
|
-
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode,
|
|
27454
|
-
lastCmd = v.lastCmd;
|
|
27455
|
-
lastArg = v.lastArg;
|
|
27456
|
-
});
|
|
27373
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27457
27374
|
loopStatus2 = rawState.status;
|
|
27458
27375
|
if (this._syncLoopAction !== void 0) {
|
|
27459
27376
|
const act = this._syncLoopAction;
|
|
@@ -27480,17 +27397,15 @@ var Runtime = class _Runtime {
|
|
|
27480
27397
|
}
|
|
27481
27398
|
rawState.variables[whileGetoptsSpec.optVar] = res.option;
|
|
27482
27399
|
touched.add(whileGetoptsSpec.optVar);
|
|
27483
|
-
lastCmd = whileGetoptsSpec.getoptsCmd;
|
|
27484
|
-
lastArg = whileGetoptsSpec.cmdLastArg;
|
|
27400
|
+
progress.lastCmd = whileGetoptsSpec.getoptsCmd;
|
|
27401
|
+
progress.lastArg = whileGetoptsSpec.cmdLastArg;
|
|
27402
|
+
progress.pipelineStatus = res.status;
|
|
27485
27403
|
if (res.status !== 0) break;
|
|
27486
27404
|
rawState.status = 0;
|
|
27487
27405
|
++iterCount;
|
|
27488
27406
|
this.budget.loop();
|
|
27489
27407
|
if ((iterCount & 127) === 0) runYieldCheckpoint(this.signal);
|
|
27490
|
-
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode,
|
|
27491
|
-
lastCmd = v.lastCmd;
|
|
27492
|
-
lastArg = v.lastArg;
|
|
27493
|
-
});
|
|
27408
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27494
27409
|
loopStatus2 = rawState.status;
|
|
27495
27410
|
if (this._syncLoopAction !== void 0) {
|
|
27496
27411
|
const act = this._syncLoopAction;
|
|
@@ -27502,19 +27417,15 @@ var Runtime = class _Runtime {
|
|
|
27502
27417
|
while (true) {
|
|
27503
27418
|
this.budget.tick();
|
|
27504
27419
|
const condNonZero = whileCondExpr !== void 0 ? (this.tryEvalConditionalSync(whileCondExpr, rawState, monitor, store, io, condLine) ?? 1) === 0 : this.evalSyncLoopArithStmt(whileArithProg, rawState, io, touched, condLine);
|
|
27505
|
-
|
|
27506
|
-
|
|
27507
|
-
lastArg = this.fastValueWord(condCmd.words[condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
27508
|
-
}
|
|
27420
|
+
progress.lastCmd = condCmd;
|
|
27421
|
+
if (condCmd.kind === "simple") progress.lastArg = this.fastValueWord(condCmd.words[condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
27509
27422
|
rawState.status = condNonZero ? 0 : 1;
|
|
27423
|
+
progress.pipelineStatus = rawState.status;
|
|
27510
27424
|
if (condNonZero !== (command.kind === "while")) break;
|
|
27511
27425
|
++iterCount;
|
|
27512
27426
|
this.budget.loop();
|
|
27513
27427
|
if ((iterCount & 127) === 0) runYieldCheckpoint(this.signal);
|
|
27514
|
-
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode,
|
|
27515
|
-
lastCmd = v.lastCmd;
|
|
27516
|
-
lastArg = v.lastArg;
|
|
27517
|
-
});
|
|
27428
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27518
27429
|
loopStatus2 = rawState.status;
|
|
27519
27430
|
if (this._syncLoopAction !== void 0) {
|
|
27520
27431
|
const act = this._syncLoopAction;
|
|
@@ -27540,15 +27451,20 @@ var Runtime = class _Runtime {
|
|
|
27540
27451
|
}
|
|
27541
27452
|
}
|
|
27542
27453
|
}
|
|
27454
|
+
lastCmd = progress.lastCmd;
|
|
27455
|
+
lastArg = progress.lastArg;
|
|
27456
|
+
lastPipelineStatus = progress.pipelineStatus;
|
|
27543
27457
|
if (lastCmd) {
|
|
27544
27458
|
if (rawState.extensions && !rawState.extensions.eventDepth) publishCommandSpelling(rawState, commandSpelling(lastCmd));
|
|
27545
27459
|
rawState.substitutionStatus = 0;
|
|
27546
27460
|
if (rawState.variables._ !== void 0 && !touched.has("_")) delete rawState.variables._;
|
|
27547
27461
|
rawState.lastArgument = lastArg;
|
|
27548
27462
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
27549
|
-
|
|
27463
|
+
}
|
|
27464
|
+
if (lastPipelineStatus !== void 0) {
|
|
27465
|
+
const statusStr = String(lastPipelineStatus);
|
|
27550
27466
|
if (!existing) {
|
|
27551
|
-
monitor.lazyPipeStatus =
|
|
27467
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27552
27468
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27553
27469
|
} else {
|
|
27554
27470
|
this.setSyncPipeStatusCell(existing, statusStr);
|
|
@@ -27824,6 +27740,7 @@ var Runtime = class _Runtime {
|
|
|
27824
27740
|
if (!ok) canUseIntRegisters = false;
|
|
27825
27741
|
else {
|
|
27826
27742
|
usedFastIntFor = true;
|
|
27743
|
+
if (fastLoopWords.length > 0) lastPipelineStatus = 0;
|
|
27827
27744
|
lastCmd = bodyAssignments[bodyAssignments.length - 1]?.cmd;
|
|
27828
27745
|
this.budget.iterations += fastLoopWords.length;
|
|
27829
27746
|
this.budget.commands += fastLoopWords.length * bodyAssignments.length + subCount;
|
|
@@ -27851,6 +27768,7 @@ var Runtime = class _Runtime {
|
|
|
27851
27768
|
loopStatus = fastLoopWords.length === 0 ? 0 : rawState.status;
|
|
27852
27769
|
lastCmd = fb.lastCmd;
|
|
27853
27770
|
lastArg = fb.lastArg;
|
|
27771
|
+
lastPipelineStatus = fb.pipelineStatus;
|
|
27854
27772
|
} finally {
|
|
27855
27773
|
this._syncReturnDepth--;
|
|
27856
27774
|
}
|
|
@@ -27889,11 +27807,13 @@ var Runtime = class _Runtime {
|
|
|
27889
27807
|
if (rawState.variables._ !== void 0 && !touched.has("_") && !(usedFastIntFor && forPlan.touchedIntNamesList.includes("_"))) delete rawState.variables._;
|
|
27890
27808
|
rawState.lastArgument = lastArg;
|
|
27891
27809
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
27810
|
+
}
|
|
27811
|
+
if (lastPipelineStatus !== void 0) {
|
|
27892
27812
|
if (!existing) {
|
|
27893
|
-
monitor.lazyPipeStatus =
|
|
27813
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27894
27814
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27895
27815
|
} else {
|
|
27896
|
-
this.setSyncPipeStatusCell(existing, String(
|
|
27816
|
+
this.setSyncPipeStatusCell(existing, String(lastPipelineStatus));
|
|
27897
27817
|
store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
|
|
27898
27818
|
}
|
|
27899
27819
|
}
|
|
@@ -28404,8 +28324,7 @@ ${s1}
|
|
|
28404
28324
|
}
|
|
28405
28325
|
runSyncArithForFallback(e0, e1, e2, inductionName, hasDeferredSteps, deferredMask, bodyAssignments, rawState, io, monitor, touched, mode, diagnosticLine) {
|
|
28406
28326
|
let enteredBody = false;
|
|
28407
|
-
|
|
28408
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28327
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
28409
28328
|
let lastInductionVal;
|
|
28410
28329
|
touched.add(inductionName);
|
|
28411
28330
|
this.syncShellArithmeticNonZero(e0, rawState, diagnosticLine);
|
|
@@ -28416,150 +28335,7 @@ ${s1}
|
|
|
28416
28335
|
if (!this.syncShellArithmeticNonZero(e1, rawState, diagnosticLine)) break;
|
|
28417
28336
|
enteredBody = true;
|
|
28418
28337
|
if (hasDeferredSteps) lastInductionVal = rawState.variables[inductionName];
|
|
28419
|
-
|
|
28420
|
-
const step = bodyAssignments[b];
|
|
28421
|
-
if (step.listOperator !== void 0 && (step.listOperator === "&&" && rawState.status !== 0 || step.listOperator === "||" && rawState.status === 0)) continue;
|
|
28422
|
-
if (step.caseClauses === void 0 && step.ifBranches === void 0 && step.nestedLoop === void 0) lastCmd = step.cmd;
|
|
28423
|
-
this.budget.tick();
|
|
28424
|
-
if (step.loopAction !== void 0) {
|
|
28425
|
-
lastArg = step.cmd.words[step.cmd.words.length - 1].plain;
|
|
28426
|
-
rawState.status = 0;
|
|
28427
|
-
this._syncLoopAction = step.loopAction;
|
|
28428
|
-
break;
|
|
28429
|
-
}
|
|
28430
|
-
if (step.unsetVars !== void 0) {
|
|
28431
|
-
lastArg = this.execSyncUnsetStep(step, rawState, monitor, touched);
|
|
28432
|
-
rawState.status = 0;
|
|
28433
|
-
continue;
|
|
28434
|
-
}
|
|
28435
|
-
if (step.localDecl !== void 0) {
|
|
28436
|
-
lastArg = this.execSyncLocalDeclStep(step.localDecl, rawState, io, monitor, touched, step.line);
|
|
28437
|
-
rawState.status = 0;
|
|
28438
|
-
continue;
|
|
28439
|
-
}
|
|
28440
|
-
if (step.shiftCount !== void 0) {
|
|
28441
|
-
const shRes = this.execSyncShiftStep(step.shiftCount, step.cmd, rawState);
|
|
28442
|
-
lastArg = shRes.lastArg;
|
|
28443
|
-
rawState.status = shRes.status;
|
|
28444
|
-
continue;
|
|
28445
|
-
}
|
|
28446
|
-
if (step.readHereString !== void 0) {
|
|
28447
|
-
lastArg = this.execSyncReadHereStringStep(step.readHereString, step, rawState, io, monitor, touched);
|
|
28448
|
-
continue;
|
|
28449
|
-
}
|
|
28450
|
-
if (deferredMask & 1 << b) {
|
|
28451
|
-
lastArg = "";
|
|
28452
|
-
rawState.status = 0;
|
|
28453
|
-
continue;
|
|
28454
|
-
}
|
|
28455
|
-
if (step.coalesceNext) {
|
|
28456
|
-
const nextStep = bodyAssignments[++b];
|
|
28457
|
-
this.budget.tick();
|
|
28458
|
-
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, nextStep.value, rawState, io);
|
|
28459
|
-
this.writeSyncRedirectStep(step, encoded, false, mode, rawState, io);
|
|
28460
|
-
this.budget.fileSystemOperation();
|
|
28461
|
-
this.budget.fileSystemOperation();
|
|
28462
|
-
this.budget.bytes += encoded.byteLength;
|
|
28463
|
-
lastCmd = nextStep.cmd;
|
|
28464
|
-
lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io) ?? "";
|
|
28465
|
-
} else if (step.targetWord !== void 0 && step.value !== void 0) {
|
|
28466
|
-
if (this.isSimpleRedirectEchoWord(step.value)) {
|
|
28467
|
-
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, void 0, rawState, io);
|
|
28468
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
28469
|
-
this.budget.fileSystemOperation();
|
|
28470
|
-
this.budget.bytes += encoded.byteLength;
|
|
28471
|
-
lastArg = this.evalSyncRedirectWord(step.value, rawState, io) ?? "";
|
|
28472
|
-
} else {
|
|
28473
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
28474
|
-
const encoded = fastSharedTextEncoder.encode(this.formatSyncEchoLine(val));
|
|
28475
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
28476
|
-
this.budget.fileSystemOperation();
|
|
28477
|
-
this.budget.bytes += encoded.byteLength;
|
|
28478
|
-
lastArg = val;
|
|
28479
|
-
}
|
|
28480
|
-
} else if (step.targetWord !== void 0 && step.printfVArgs !== void 0) {
|
|
28481
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
28482
|
-
const encoded = fastSharedTextEncoder.encode(formatted2);
|
|
28483
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
28484
|
-
this.budget.fileSystemOperation();
|
|
28485
|
-
this.budget.bytes += encoded.byteLength;
|
|
28486
|
-
lastArg = pLastArg;
|
|
28487
|
-
} else if (step.isStdoutEcho && step.value !== void 0) {
|
|
28488
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
28489
|
-
this.writeSyncStdoutText(this.formatSyncEchoLine(val), io);
|
|
28490
|
-
lastArg = val;
|
|
28491
|
-
} else if (step.isStdoutEcho && step.printfVArgs !== void 0) {
|
|
28492
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
28493
|
-
this.writeSyncStdoutText(formatted2, io);
|
|
28494
|
-
lastArg = pLastArg;
|
|
28495
|
-
} else if (step.arrayAssign !== void 0) {
|
|
28496
|
-
if (!this.tryFastArrayAssignmentSync(step.arrayAssign, rawState, io, step.line, void 0, void 0, true)) {
|
|
28497
|
-
throw new Error("Synchronous loop array assignment was not executable");
|
|
28498
|
-
}
|
|
28499
|
-
lastArg = "";
|
|
28500
|
-
} else if (step.caseClauses !== void 0) {
|
|
28501
|
-
this.flushSyncStdoutBatch(io);
|
|
28502
|
-
this.execSyncCaseStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28503
|
-
lastCmd = v.lastCmd;
|
|
28504
|
-
lastArg = v.lastArg;
|
|
28505
|
-
});
|
|
28506
|
-
if (this._syncLoopAction !== void 0) break;
|
|
28507
|
-
continue;
|
|
28508
|
-
} else if (step.ifBranches !== void 0) {
|
|
28509
|
-
this.flushSyncStdoutBatch(io);
|
|
28510
|
-
this.execSyncIfStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28511
|
-
lastCmd = v.lastCmd;
|
|
28512
|
-
lastArg = v.lastArg;
|
|
28513
|
-
});
|
|
28514
|
-
if (this._syncLoopAction !== void 0) break;
|
|
28515
|
-
continue;
|
|
28516
|
-
} else if (step.condStmt !== void 0) {
|
|
28517
|
-
const cStatus = this.tryEvalConditionalSync(step.condStmt, rawState, monitor, arrayStore(rawState), io, step.line) ?? 1;
|
|
28518
|
-
if (step.cmd.kind === "simple") {
|
|
28519
|
-
lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28520
|
-
}
|
|
28521
|
-
rawState.status = cStatus;
|
|
28522
|
-
continue;
|
|
28523
|
-
} else if (step.nestedLoop !== void 0) {
|
|
28524
|
-
this.flushSyncStdoutBatch(io);
|
|
28525
|
-
this.execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28526
|
-
lastCmd = v.lastCmd;
|
|
28527
|
-
lastArg = v.lastArg;
|
|
28528
|
-
});
|
|
28529
|
-
continue;
|
|
28530
|
-
} else if (step.fnCall !== void 0) {
|
|
28531
|
-
this.flushSyncStdoutBatch(io);
|
|
28532
|
-
this.execSyncFnStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28533
|
-
lastCmd = v.lastCmd;
|
|
28534
|
-
lastArg = v.lastArg;
|
|
28535
|
-
});
|
|
28536
|
-
continue;
|
|
28537
|
-
} else if (step.arithStmt !== void 0) {
|
|
28538
|
-
const nonZero = this.evalSyncLoopArithStmt(step.arithStmt, rawState, io, touched, step.line);
|
|
28539
|
-
rawState.status = nonZero ? 0 : 1;
|
|
28540
|
-
continue;
|
|
28541
|
-
} else if (step.printfVArgs !== void 0 && step.name !== void 0) {
|
|
28542
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
28543
|
-
rawState.variables[step.name] = formatted2;
|
|
28544
|
-
touched.add(step.name);
|
|
28545
|
-
lastArg = pLastArg;
|
|
28546
|
-
} else if (step.isDiscardDevNull && step.discardWords !== void 0) {
|
|
28547
|
-
lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
28548
|
-
} else if (step.name !== void 0 && step.value !== void 0) {
|
|
28549
|
-
rawState.substitutionStatus = 0;
|
|
28550
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
28551
|
-
if (step.append) {
|
|
28552
|
-
const curRaw = rawState.variables[step.name];
|
|
28553
|
-
const curStr = curRaw === void 0 ? "" : touched.has(step.name) ? curRaw : monitor.values.get(step.name, curRaw) ?? curRaw;
|
|
28554
|
-
rawState.variables[step.name] = (typeof curStr === "string" ? curStr : "") + val;
|
|
28555
|
-
} else rawState.variables[step.name] = val;
|
|
28556
|
-
touched.add(step.name);
|
|
28557
|
-
lastArg = "";
|
|
28558
|
-
} else {
|
|
28559
|
-
lastArg = step.cmd.words[0].plain;
|
|
28560
|
-
}
|
|
28561
|
-
rawState.status = step.name !== void 0 && step.value !== void 0 ? rawState.substitutionStatus : 0;
|
|
28562
|
-
}
|
|
28338
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress, deferredMask);
|
|
28563
28339
|
if (this._syncLoopAction !== void 0) {
|
|
28564
28340
|
const act = this._syncLoopAction;
|
|
28565
28341
|
this._syncLoopAction = void 0;
|
|
@@ -28569,7 +28345,7 @@ ${s1}
|
|
|
28569
28345
|
}
|
|
28570
28346
|
this.flushSyncStdoutBatch(io);
|
|
28571
28347
|
if (!enteredBody) rawState.status = 0;
|
|
28572
|
-
return {
|
|
28348
|
+
return { ...progress, lastInductionVal };
|
|
28573
28349
|
}
|
|
28574
28350
|
_syncLoopFnCheckDepth = 0;
|
|
28575
28351
|
canSyncReadOnlyArraySubscripts(tree, rawState) {
|
|
@@ -28738,7 +28514,7 @@ ${s1}
|
|
|
28738
28514
|
rawState.positional = savedPos;
|
|
28739
28515
|
}
|
|
28740
28516
|
}
|
|
28741
|
-
execSyncFnStep(step, rawState, io, monitor, touched, mode,
|
|
28517
|
+
execSyncFnStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28742
28518
|
const fnCall = step.fnCall;
|
|
28743
28519
|
const fnArgs = [];
|
|
28744
28520
|
for (let i = 0; i < fnCall.argWords.length; i++) {
|
|
@@ -28774,12 +28550,14 @@ ${s1}
|
|
|
28774
28550
|
}
|
|
28775
28551
|
}
|
|
28776
28552
|
if (fnCall.steps.length > 0) {
|
|
28777
|
-
this.execSyncLoopSteps(fnCall.steps, rawState, io, monitor, touched, mode,
|
|
28553
|
+
this.execSyncLoopSteps(fnCall.steps, rawState, io, monitor, touched, mode, progress);
|
|
28778
28554
|
} else {
|
|
28779
28555
|
rawState.status = 0;
|
|
28780
28556
|
}
|
|
28781
28557
|
rawState.lastArgument = fnArgs.at(-1) ?? fnCall.name;
|
|
28782
|
-
|
|
28558
|
+
progress.lastCmd = step.cmd;
|
|
28559
|
+
progress.lastArg = rawState.lastArgument;
|
|
28560
|
+
progress.pipelineStatus = rawState.status;
|
|
28783
28561
|
} finally {
|
|
28784
28562
|
for (let i = savedLocals.length - 1; i >= 0; i--) {
|
|
28785
28563
|
const saved = savedLocals[i];
|
|
@@ -28795,16 +28573,10 @@ ${s1}
|
|
|
28795
28573
|
this._fastSubPositional = prevFastSubPos;
|
|
28796
28574
|
}
|
|
28797
28575
|
}
|
|
28798
|
-
execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode,
|
|
28576
|
+
execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28799
28577
|
const nl = step.nestedLoop;
|
|
28800
28578
|
const lc = nl.loopCmd;
|
|
28801
|
-
let innerLastCmd;
|
|
28802
|
-
let innerLastArg = "";
|
|
28803
28579
|
let innerStatus = 0;
|
|
28804
|
-
const updateInner = (v) => {
|
|
28805
|
-
innerLastCmd = v.lastCmd;
|
|
28806
|
-
innerLastArg = v.lastArg;
|
|
28807
|
-
};
|
|
28808
28580
|
rawState.loopDepth++;
|
|
28809
28581
|
try {
|
|
28810
28582
|
if (lc.kind === "arithmetic-for") {
|
|
@@ -28817,7 +28589,7 @@ ${s1}
|
|
|
28817
28589
|
while (this.syncShellArithmeticNonZero(e1, rawState, nl.condLine)) {
|
|
28818
28590
|
this.budget.loop();
|
|
28819
28591
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28820
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28592
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28821
28593
|
innerStatus = rawState.status;
|
|
28822
28594
|
if (this._syncLoopAction !== void 0) {
|
|
28823
28595
|
const act = this._syncLoopAction;
|
|
@@ -28834,7 +28606,7 @@ ${s1}
|
|
|
28834
28606
|
this.budget.loop();
|
|
28835
28607
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28836
28608
|
rawState.variables[lc.name] = words[i];
|
|
28837
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28609
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28838
28610
|
innerStatus = rawState.status;
|
|
28839
28611
|
if (this._syncLoopAction !== void 0) {
|
|
28840
28612
|
const act = this._syncLoopAction;
|
|
@@ -28847,15 +28619,14 @@ ${s1}
|
|
|
28847
28619
|
while (true) {
|
|
28848
28620
|
this.budget.tick();
|
|
28849
28621
|
const condOk = nl.condExpr !== void 0 ? (this.tryEvalConditionalSync(nl.condExpr, rawState, monitor, arrayStore(rawState), io, nl.condLine) ?? 1) === 0 : this.evalSyncLoopArithStmt(nl.condArith, rawState, io, touched, nl.condLine);
|
|
28850
|
-
|
|
28851
|
-
|
|
28852
|
-
innerLastArg = this.fastValueWord(nl.condCmd.words[nl.condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28853
|
-
}
|
|
28622
|
+
progress.lastCmd = nl.condCmd;
|
|
28623
|
+
if (nl.condCmd?.kind === "simple") progress.lastArg = this.fastValueWord(nl.condCmd.words[nl.condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28854
28624
|
rawState.status = condOk ? 0 : 1;
|
|
28625
|
+
progress.pipelineStatus = rawState.status;
|
|
28855
28626
|
if (condOk !== (lc.kind === "while")) break;
|
|
28856
28627
|
this.budget.loop();
|
|
28857
28628
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28858
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28629
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28859
28630
|
innerStatus = rawState.status;
|
|
28860
28631
|
if (this._syncLoopAction !== void 0) {
|
|
28861
28632
|
const act = this._syncLoopAction;
|
|
@@ -28868,16 +28639,15 @@ ${s1}
|
|
|
28868
28639
|
rawState.loopDepth--;
|
|
28869
28640
|
}
|
|
28870
28641
|
rawState.status = innerStatus;
|
|
28871
|
-
if (innerLastCmd) onUpdate({ lastCmd: innerLastCmd, lastArg: innerLastArg });
|
|
28872
28642
|
}
|
|
28873
|
-
execSyncCaseStep(step, rawState, io, monitor, touched, mode,
|
|
28643
|
+
execSyncCaseStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28874
28644
|
const subj = this.fastValueWord(step.caseSubject, rawState, io, false, false, false, false, 0, step.line);
|
|
28875
28645
|
const work = { remaining: this.budget.limits.maxExpansionBytes, signal: this.signal, exhausted: () => this.budget.fail("maxExpansionBytes") };
|
|
28876
28646
|
let chosen;
|
|
28877
28647
|
for (let ci = 0; ci < step.caseClauses.length; ci++) {
|
|
28878
28648
|
const cl = step.caseClauses[ci];
|
|
28879
28649
|
for (let pi = 0; pi < cl.patterns.length; pi++) {
|
|
28880
|
-
const pattern =
|
|
28650
|
+
const pattern = this.tryBuildSyncPatternWord(cl.patterns[pi], rawState, io, step.line);
|
|
28881
28651
|
if (pattern !== void 0 && tryMatchesPatternSync(pattern, subj, work, false, false)) {
|
|
28882
28652
|
chosen = cl.steps;
|
|
28883
28653
|
break;
|
|
@@ -28888,17 +28658,19 @@ ${s1}
|
|
|
28888
28658
|
if (!chosen) {
|
|
28889
28659
|
rawState.status = 0;
|
|
28890
28660
|
} else {
|
|
28891
|
-
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode,
|
|
28661
|
+
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode, progress);
|
|
28892
28662
|
}
|
|
28893
28663
|
}
|
|
28894
|
-
execSyncIfStep(step, rawState, io, monitor, touched, mode,
|
|
28664
|
+
execSyncIfStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28895
28665
|
let chosen;
|
|
28896
28666
|
for (let bi = 0; bi < step.ifBranches.length; bi++) {
|
|
28897
28667
|
const br = step.ifBranches[bi];
|
|
28898
28668
|
this.budget.tick();
|
|
28899
28669
|
const condOk = br.condExpr !== void 0 ? (this.tryEvalConditionalSync(br.condExpr, rawState, monitor, arrayStore(rawState), io, br.condLine) ?? 1) === 0 : this.evalSyncLoopArithStmt(br.cond, rawState, io, touched, br.condLine);
|
|
28900
|
-
|
|
28670
|
+
progress.lastCmd = br.condCmd;
|
|
28671
|
+
if (br.condCmd.kind === "simple") progress.lastArg = this.fastValueWord(br.condCmd.words[br.condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28901
28672
|
rawState.status = condOk ? 0 : 1;
|
|
28673
|
+
progress.pipelineStatus = rawState.status;
|
|
28902
28674
|
if (condOk) {
|
|
28903
28675
|
chosen = br.steps;
|
|
28904
28676
|
break;
|
|
@@ -28908,90 +28680,48 @@ ${s1}
|
|
|
28908
28680
|
if (!chosen) {
|
|
28909
28681
|
rawState.status = 0;
|
|
28910
28682
|
} else {
|
|
28911
|
-
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode,
|
|
28683
|
+
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode, progress);
|
|
28912
28684
|
}
|
|
28913
28685
|
}
|
|
28914
|
-
execSyncLoopSteps(steps, rawState, io, monitor, touched, mode,
|
|
28915
|
-
let lastCmd;
|
|
28916
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28686
|
+
execSyncLoopSteps(steps, rawState, io, monitor, touched, mode, progress, deferredMask = 0) {
|
|
28917
28687
|
for (let b = 0; b < steps.length; b++) {
|
|
28918
28688
|
const step = steps[b];
|
|
28919
28689
|
if (step.listOperator !== void 0 && (step.listOperator === "&&" && rawState.status !== 0 || step.listOperator === "||" && rawState.status === 0)) continue;
|
|
28920
|
-
if (step.caseClauses === void 0 && step.ifBranches === void 0 && step.nestedLoop === void 0) lastCmd = step.cmd;
|
|
28921
28690
|
this.budget.tick();
|
|
28922
|
-
if (step.
|
|
28923
|
-
|
|
28924
|
-
|
|
28925
|
-
this.
|
|
28926
|
-
|
|
28927
|
-
|
|
28928
|
-
}
|
|
28929
|
-
if (step.unsetVars !== void 0) {
|
|
28930
|
-
lastArg = this.execSyncUnsetStep(step, rawState, monitor, touched);
|
|
28931
|
-
rawState.status = 0;
|
|
28932
|
-
onUpdate({ lastCmd, lastArg });
|
|
28933
|
-
continue;
|
|
28934
|
-
}
|
|
28935
|
-
if (step.localDecl !== void 0) {
|
|
28936
|
-
lastArg = this.execSyncLocalDeclStep(step.localDecl, rawState, io, monitor, touched, step.line);
|
|
28937
|
-
rawState.status = 0;
|
|
28938
|
-
onUpdate({ lastCmd, lastArg });
|
|
28939
|
-
continue;
|
|
28940
|
-
}
|
|
28941
|
-
if (step.shiftCount !== void 0) {
|
|
28942
|
-
const shRes = this.execSyncShiftStep(step.shiftCount, step.cmd, rawState);
|
|
28943
|
-
lastArg = shRes.lastArg;
|
|
28944
|
-
rawState.status = shRes.status;
|
|
28945
|
-
onUpdate({ lastCmd, lastArg });
|
|
28946
|
-
continue;
|
|
28947
|
-
}
|
|
28948
|
-
if (step.readHereString !== void 0) {
|
|
28949
|
-
lastArg = this.execSyncReadHereStringStep(step.readHereString, step, rawState, io, monitor, touched);
|
|
28950
|
-
onUpdate({ lastCmd, lastArg });
|
|
28951
|
-
continue;
|
|
28952
|
-
}
|
|
28953
|
-
if (step.nestedLoop !== void 0) {
|
|
28954
|
-
this.execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28955
|
-
lastCmd = v.lastCmd;
|
|
28956
|
-
lastArg = v.lastArg;
|
|
28957
|
-
onUpdate(v);
|
|
28958
|
-
});
|
|
28959
|
-
continue;
|
|
28960
|
-
} else if (step.fnCall !== void 0) {
|
|
28961
|
-
this.execSyncFnStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28962
|
-
lastCmd = v.lastCmd;
|
|
28963
|
-
lastArg = v.lastArg;
|
|
28964
|
-
onUpdate(v);
|
|
28965
|
-
});
|
|
28966
|
-
continue;
|
|
28967
|
-
} else if (step.caseClauses !== void 0) {
|
|
28968
|
-
this.execSyncCaseStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28969
|
-
lastCmd = v.lastCmd;
|
|
28970
|
-
lastArg = v.lastArg;
|
|
28971
|
-
onUpdate(v);
|
|
28972
|
-
});
|
|
28973
|
-
if (this._syncLoopAction !== void 0) break;
|
|
28974
|
-
continue;
|
|
28975
|
-
} else if (step.ifBranches !== void 0) {
|
|
28976
|
-
this.execSyncIfStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
28977
|
-
lastCmd = v.lastCmd;
|
|
28978
|
-
lastArg = v.lastArg;
|
|
28979
|
-
onUpdate(v);
|
|
28980
|
-
});
|
|
28691
|
+
if (step.nestedLoop !== void 0 || step.fnCall !== void 0 || step.caseClauses !== void 0 || step.ifBranches !== void 0) {
|
|
28692
|
+
this.flushSyncStdoutBatch(io);
|
|
28693
|
+
if (step.nestedLoop !== void 0) this.execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28694
|
+
else if (step.fnCall !== void 0) this.execSyncFnStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28695
|
+
else if (step.caseClauses !== void 0) this.execSyncCaseStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28696
|
+
else this.execSyncIfStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28981
28697
|
if (this._syncLoopAction !== void 0) break;
|
|
28982
28698
|
continue;
|
|
28699
|
+
}
|
|
28700
|
+
progress.lastCmd = step.cmd;
|
|
28701
|
+
let status = 0;
|
|
28702
|
+
if (step.loopAction !== void 0) {
|
|
28703
|
+
progress.lastArg = step.cmd.words[step.cmd.words.length - 1].plain;
|
|
28704
|
+
this._syncLoopAction = step.loopAction;
|
|
28705
|
+
} else if (step.unsetVars !== void 0) {
|
|
28706
|
+
progress.lastArg = this.execSyncUnsetStep(step, rawState, monitor, touched);
|
|
28707
|
+
} else if (step.localDecl !== void 0) {
|
|
28708
|
+
progress.lastArg = this.execSyncLocalDeclStep(step.localDecl, rawState, io, monitor, touched, step.line);
|
|
28709
|
+
} else if (step.shiftCount !== void 0) {
|
|
28710
|
+
const result = this.execSyncShiftStep(step.shiftCount, step.cmd, rawState);
|
|
28711
|
+
progress.lastArg = result.lastArg;
|
|
28712
|
+
status = result.status;
|
|
28713
|
+
} else if (step.readHereString !== void 0) {
|
|
28714
|
+
progress.lastArg = this.execSyncReadHereStringStep(step.readHereString, step, rawState, io, monitor, touched);
|
|
28715
|
+
status = rawState.status;
|
|
28716
|
+
} else if (deferredMask & 1 << b) {
|
|
28717
|
+
progress.lastArg = "";
|
|
28983
28718
|
} else if (step.condStmt !== void 0) {
|
|
28984
|
-
|
|
28719
|
+
status = this.tryEvalConditionalSync(step.condStmt, rawState, monitor, arrayStore(rawState), io, step.line) ?? 1;
|
|
28985
28720
|
if (step.cmd.kind === "simple") {
|
|
28986
|
-
lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28987
|
-
onUpdate({ lastCmd, lastArg });
|
|
28721
|
+
progress.lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28988
28722
|
}
|
|
28989
|
-
rawState.status = cStatus;
|
|
28990
|
-
continue;
|
|
28991
28723
|
} else if (step.arithStmt !== void 0) {
|
|
28992
|
-
|
|
28993
|
-
rawState.status = nonZero ? 0 : 1;
|
|
28994
|
-
continue;
|
|
28724
|
+
status = this.evalSyncLoopArithStmt(step.arithStmt, rawState, io, touched, step.line) ? 0 : 1;
|
|
28995
28725
|
} else if (step.coalesceNext) {
|
|
28996
28726
|
const nextStep = steps[++b];
|
|
28997
28727
|
this.budget.tick();
|
|
@@ -29000,42 +28730,42 @@ ${s1}
|
|
|
29000
28730
|
this.budget.fileSystemOperation();
|
|
29001
28731
|
this.budget.fileSystemOperation();
|
|
29002
28732
|
this.budget.bytes += encoded.byteLength;
|
|
29003
|
-
lastCmd = nextStep.cmd;
|
|
29004
|
-
lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io);
|
|
28733
|
+
progress.lastCmd = nextStep.cmd;
|
|
28734
|
+
progress.lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io);
|
|
29005
28735
|
} else if (step.targetWord !== void 0 && step.value !== void 0) {
|
|
29006
28736
|
if (this.isSimpleRedirectEchoWord(step.value)) {
|
|
29007
28737
|
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, void 0, rawState, io);
|
|
29008
28738
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29009
28739
|
this.budget.fileSystemOperation();
|
|
29010
28740
|
this.budget.bytes += encoded.byteLength;
|
|
29011
|
-
lastArg = this.evalSyncRedirectWord(step.value, rawState, io);
|
|
28741
|
+
progress.lastArg = this.evalSyncRedirectWord(step.value, rawState, io);
|
|
29012
28742
|
} else {
|
|
29013
28743
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29014
28744
|
const encoded = fastSharedTextEncoder.encode(this.formatSyncEchoLine(val));
|
|
29015
28745
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29016
28746
|
this.budget.fileSystemOperation();
|
|
29017
28747
|
this.budget.bytes += encoded.byteLength;
|
|
29018
|
-
lastArg = val;
|
|
28748
|
+
progress.lastArg = val;
|
|
29019
28749
|
}
|
|
29020
28750
|
} else if (step.targetWord !== void 0 && step.printfVArgs !== void 0) {
|
|
29021
|
-
const { formatted: formatted2, lastArg
|
|
28751
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29022
28752
|
const encoded = fastSharedTextEncoder.encode(formatted2);
|
|
29023
28753
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29024
28754
|
this.budget.fileSystemOperation();
|
|
29025
28755
|
this.budget.bytes += encoded.byteLength;
|
|
29026
|
-
lastArg =
|
|
28756
|
+
progress.lastArg = lastArg;
|
|
29027
28757
|
} else if (step.arrayAssign !== void 0) {
|
|
29028
28758
|
if (!this.tryFastArrayAssignmentSync(step.arrayAssign, rawState, io, step.line, void 0, void 0, true)) {
|
|
29029
28759
|
throw new Error("Synchronous loop array assignment was not executable");
|
|
29030
28760
|
}
|
|
29031
|
-
lastArg = "";
|
|
28761
|
+
progress.lastArg = "";
|
|
29032
28762
|
} else if (step.printfVArgs !== void 0 && step.name !== void 0) {
|
|
29033
|
-
const { formatted: formatted2, lastArg
|
|
28763
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29034
28764
|
rawState.variables[step.name] = formatted2;
|
|
29035
28765
|
touched.add(step.name);
|
|
29036
|
-
lastArg =
|
|
28766
|
+
progress.lastArg = lastArg;
|
|
29037
28767
|
} else if (step.isDiscardDevNull && step.discardWords !== void 0) {
|
|
29038
|
-
lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
28768
|
+
progress.lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
29039
28769
|
} else if (step.name !== void 0 && step.value !== void 0) {
|
|
29040
28770
|
rawState.substitutionStatus = 0;
|
|
29041
28771
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
@@ -29045,165 +28775,32 @@ ${s1}
|
|
|
29045
28775
|
rawState.variables[step.name] = (typeof curStr === "string" ? curStr : "") + val;
|
|
29046
28776
|
} else rawState.variables[step.name] = val;
|
|
29047
28777
|
touched.add(step.name);
|
|
29048
|
-
lastArg = "";
|
|
28778
|
+
progress.lastArg = "";
|
|
28779
|
+
status = rawState.substitutionStatus;
|
|
29049
28780
|
} else if (step.isStdoutEcho && step.value !== void 0) {
|
|
29050
28781
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29051
28782
|
this.writeSyncStdoutText(this.formatSyncEchoLine(val), io);
|
|
29052
|
-
lastArg = val;
|
|
28783
|
+
progress.lastArg = val;
|
|
29053
28784
|
} else if (step.isStdoutEcho && step.printfVArgs !== void 0) {
|
|
29054
|
-
const { formatted: formatted2, lastArg
|
|
28785
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29055
28786
|
this.writeSyncStdoutText(formatted2, io);
|
|
29056
|
-
lastArg =
|
|
28787
|
+
progress.lastArg = lastArg;
|
|
29057
28788
|
} else {
|
|
29058
|
-
lastArg = step.cmd.words[0].plain;
|
|
28789
|
+
progress.lastArg = step.cmd.words[0].plain;
|
|
29059
28790
|
}
|
|
29060
|
-
rawState.status =
|
|
29061
|
-
|
|
28791
|
+
rawState.status = status;
|
|
28792
|
+
progress.pipelineStatus = status;
|
|
28793
|
+
if (this._syncLoopAction !== void 0) break;
|
|
29062
28794
|
}
|
|
29063
28795
|
}
|
|
29064
28796
|
runSyncForFallback(varName, fastLoopWords, bodyAssignments, rawState, io, monitor, touched, mode) {
|
|
29065
|
-
|
|
29066
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28797
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
29067
28798
|
let loopTurn = 0;
|
|
29068
28799
|
for (let idx = 0; idx < fastLoopWords.length; idx++) {
|
|
29069
28800
|
this.budget.loop();
|
|
29070
28801
|
if ((++loopTurn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
29071
28802
|
rawState.variables[varName] = fastLoopWords[idx];
|
|
29072
|
-
|
|
29073
|
-
const step = bodyAssignments[b];
|
|
29074
|
-
if (step.listOperator !== void 0 && (step.listOperator === "&&" && rawState.status !== 0 || step.listOperator === "||" && rawState.status === 0)) continue;
|
|
29075
|
-
if (step.caseClauses === void 0 && step.ifBranches === void 0 && step.nestedLoop === void 0) lastCmd = step.cmd;
|
|
29076
|
-
this.budget.tick();
|
|
29077
|
-
if (step.loopAction !== void 0) {
|
|
29078
|
-
lastArg = step.cmd.words[step.cmd.words.length - 1].plain;
|
|
29079
|
-
rawState.status = 0;
|
|
29080
|
-
this._syncLoopAction = step.loopAction;
|
|
29081
|
-
break;
|
|
29082
|
-
}
|
|
29083
|
-
if (step.unsetVars !== void 0) {
|
|
29084
|
-
lastArg = this.execSyncUnsetStep(step, rawState, monitor, touched);
|
|
29085
|
-
rawState.status = 0;
|
|
29086
|
-
continue;
|
|
29087
|
-
}
|
|
29088
|
-
if (step.localDecl !== void 0) {
|
|
29089
|
-
lastArg = this.execSyncLocalDeclStep(step.localDecl, rawState, io, monitor, touched, step.line);
|
|
29090
|
-
rawState.status = 0;
|
|
29091
|
-
continue;
|
|
29092
|
-
}
|
|
29093
|
-
if (step.shiftCount !== void 0) {
|
|
29094
|
-
const shRes = this.execSyncShiftStep(step.shiftCount, step.cmd, rawState);
|
|
29095
|
-
lastArg = shRes.lastArg;
|
|
29096
|
-
rawState.status = shRes.status;
|
|
29097
|
-
continue;
|
|
29098
|
-
}
|
|
29099
|
-
if (step.readHereString !== void 0) {
|
|
29100
|
-
lastArg = this.execSyncReadHereStringStep(step.readHereString, step, rawState, io, monitor, touched);
|
|
29101
|
-
continue;
|
|
29102
|
-
}
|
|
29103
|
-
if (step.coalesceNext) {
|
|
29104
|
-
const nextStep = bodyAssignments[++b];
|
|
29105
|
-
this.budget.tick();
|
|
29106
|
-
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, nextStep.value, rawState, io);
|
|
29107
|
-
this.writeSyncRedirectStep(step, encoded, false, mode, rawState, io);
|
|
29108
|
-
this.budget.fileSystemOperation();
|
|
29109
|
-
this.budget.fileSystemOperation();
|
|
29110
|
-
this.budget.bytes += encoded.byteLength;
|
|
29111
|
-
lastCmd = nextStep.cmd;
|
|
29112
|
-
lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io) ?? "";
|
|
29113
|
-
} else if (step.targetWord !== void 0 && step.value !== void 0) {
|
|
29114
|
-
if (this.isSimpleRedirectEchoWord(step.value)) {
|
|
29115
|
-
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, void 0, rawState, io);
|
|
29116
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29117
|
-
this.budget.fileSystemOperation();
|
|
29118
|
-
this.budget.bytes += encoded.byteLength;
|
|
29119
|
-
lastArg = this.evalSyncRedirectWord(step.value, rawState, io) ?? "";
|
|
29120
|
-
} else {
|
|
29121
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29122
|
-
const encoded = fastSharedTextEncoder.encode(this.formatSyncEchoLine(val));
|
|
29123
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29124
|
-
this.budget.fileSystemOperation();
|
|
29125
|
-
this.budget.bytes += encoded.byteLength;
|
|
29126
|
-
lastArg = val;
|
|
29127
|
-
}
|
|
29128
|
-
} else if (step.targetWord !== void 0 && step.printfVArgs !== void 0) {
|
|
29129
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29130
|
-
const encoded = fastSharedTextEncoder.encode(formatted2);
|
|
29131
|
-
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29132
|
-
this.budget.fileSystemOperation();
|
|
29133
|
-
this.budget.bytes += encoded.byteLength;
|
|
29134
|
-
lastArg = pLastArg;
|
|
29135
|
-
} else if (step.nestedLoop !== void 0) {
|
|
29136
|
-
this.execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
29137
|
-
lastCmd = v.lastCmd;
|
|
29138
|
-
lastArg = v.lastArg;
|
|
29139
|
-
});
|
|
29140
|
-
continue;
|
|
29141
|
-
} else if (step.fnCall !== void 0) {
|
|
29142
|
-
this.execSyncFnStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
29143
|
-
lastCmd = v.lastCmd;
|
|
29144
|
-
lastArg = v.lastArg;
|
|
29145
|
-
});
|
|
29146
|
-
continue;
|
|
29147
|
-
} else if (step.caseClauses !== void 0) {
|
|
29148
|
-
this.execSyncCaseStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
29149
|
-
lastCmd = v.lastCmd;
|
|
29150
|
-
lastArg = v.lastArg;
|
|
29151
|
-
});
|
|
29152
|
-
if (this._syncLoopAction !== void 0) break;
|
|
29153
|
-
continue;
|
|
29154
|
-
} else if (step.ifBranches !== void 0) {
|
|
29155
|
-
this.execSyncIfStep(step, rawState, io, monitor, touched, mode, (v) => {
|
|
29156
|
-
lastCmd = v.lastCmd;
|
|
29157
|
-
lastArg = v.lastArg;
|
|
29158
|
-
});
|
|
29159
|
-
if (this._syncLoopAction !== void 0) break;
|
|
29160
|
-
continue;
|
|
29161
|
-
} else if (step.condStmt !== void 0) {
|
|
29162
|
-
const cStatus = this.tryEvalConditionalSync(step.condStmt, rawState, monitor, arrayStore(rawState), io, step.line) ?? 1;
|
|
29163
|
-
if (step.cmd.kind === "simple") {
|
|
29164
|
-
lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
|
|
29165
|
-
}
|
|
29166
|
-
rawState.status = cStatus;
|
|
29167
|
-
continue;
|
|
29168
|
-
} else if (step.arrayAssign !== void 0) {
|
|
29169
|
-
if (!this.tryFastArrayAssignmentSync(step.arrayAssign, rawState, io, step.line, void 0, void 0, true)) {
|
|
29170
|
-
throw new Error("Synchronous loop array assignment was not executable");
|
|
29171
|
-
}
|
|
29172
|
-
lastArg = "";
|
|
29173
|
-
} else if (step.arithStmt !== void 0) {
|
|
29174
|
-
const nonZero = this.evalSyncLoopArithStmt(step.arithStmt, rawState, io, touched, step.line);
|
|
29175
|
-
rawState.status = nonZero ? 0 : 1;
|
|
29176
|
-
continue;
|
|
29177
|
-
} else if (step.printfVArgs !== void 0 && step.name !== void 0) {
|
|
29178
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line);
|
|
29179
|
-
rawState.variables[step.name] = formatted2;
|
|
29180
|
-
touched.add(step.name);
|
|
29181
|
-
lastArg = pLastArg;
|
|
29182
|
-
} else if (step.isDiscardDevNull && step.discardWords !== void 0) {
|
|
29183
|
-
lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
29184
|
-
} else if (step.name !== void 0 && step.value !== void 0) {
|
|
29185
|
-
rawState.substitutionStatus = 0;
|
|
29186
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29187
|
-
if (step.append) {
|
|
29188
|
-
const curRaw = rawState.variables[step.name];
|
|
29189
|
-
const curStr = curRaw === void 0 ? "" : touched.has(step.name) ? curRaw : monitor.values.get(step.name, curRaw) ?? curRaw;
|
|
29190
|
-
rawState.variables[step.name] = (typeof curStr === "string" ? curStr : "") + val;
|
|
29191
|
-
} else rawState.variables[step.name] = val;
|
|
29192
|
-
touched.add(step.name);
|
|
29193
|
-
lastArg = "";
|
|
29194
|
-
} else if (step.isStdoutEcho && step.value !== void 0) {
|
|
29195
|
-
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29196
|
-
this.writeSyncStdoutText(this.formatSyncEchoLine(val), io);
|
|
29197
|
-
lastArg = val;
|
|
29198
|
-
} else if (step.isStdoutEcho && step.printfVArgs !== void 0) {
|
|
29199
|
-
const { formatted: formatted2, lastArg: pLastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29200
|
-
this.writeSyncStdoutText(formatted2, io);
|
|
29201
|
-
lastArg = pLastArg;
|
|
29202
|
-
} else {
|
|
29203
|
-
lastArg = step.cmd.words[0].plain;
|
|
29204
|
-
}
|
|
29205
|
-
rawState.status = step.name !== void 0 && step.value !== void 0 ? rawState.substitutionStatus : 0;
|
|
29206
|
-
}
|
|
28803
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
29207
28804
|
if (this._syncLoopAction !== void 0) {
|
|
29208
28805
|
const act = this._syncLoopAction;
|
|
29209
28806
|
this._syncLoopAction = void 0;
|
|
@@ -29211,7 +28808,7 @@ ${s1}
|
|
|
29211
28808
|
}
|
|
29212
28809
|
}
|
|
29213
28810
|
this.flushSyncStdoutBatch(io);
|
|
29214
|
-
return
|
|
28811
|
+
return progress;
|
|
29215
28812
|
}
|
|
29216
28813
|
async script(script, state, io, startListIndex = 0, startPipelineIndex = 0, skipFirstSync = false) {
|
|
29217
28814
|
if (state.extensions?.syntax.indexedDeclarations?.includes("readonly")) io.assignmentDiagnosticContext ??= { name: void 0 };
|
|
@@ -29492,13 +29089,12 @@ ${s1}
|
|
|
29492
29089
|
try {
|
|
29493
29090
|
const isFastPure = isPureStage || runtime.isPureExternalStageCommand(command, rawStateForChild);
|
|
29494
29091
|
const forkedExt = isFastPure ? forkExtensions(state.extensions, "pipeline") : void 0;
|
|
29495
|
-
const child = isFastPure ? Object.assign(
|
|
29092
|
+
const child = isFastPure ? Object.assign(cloneRawState(rawStateForChild, false), {
|
|
29496
29093
|
extensions: forkedExt,
|
|
29497
29094
|
isolated: true,
|
|
29498
29095
|
_readOnlyStage: true
|
|
29499
29096
|
}) : tryCloneStateSync(state) ?? await cloneState(state, this.signal);
|
|
29500
29097
|
preparedChild = child;
|
|
29501
|
-
if (child._readOnlyStage) child.variables = { ...child.variables };
|
|
29502
29098
|
child.variables.BASH_SUBSHELL = String(Number(state.variables.BASH_SUBSHELL ?? 0) + 1);
|
|
29503
29099
|
if (!child._readOnlyStage) {
|
|
29504
29100
|
child.extensions = void 0;
|
|
@@ -29756,7 +29352,7 @@ ${s1}
|
|
|
29756
29352
|
}
|
|
29757
29353
|
}
|
|
29758
29354
|
}
|
|
29759
|
-
const extDef = this.
|
|
29355
|
+
const extDef = this.commands.get(firstName);
|
|
29760
29356
|
return extDef !== void 0 && !customRegisteredCommands.has(extDef.execute) && !customRegisteredRegistries.has(this.commands);
|
|
29761
29357
|
}
|
|
29762
29358
|
publishStatus(state, statuses, io, terminal) {
|
|
@@ -30031,7 +29627,7 @@ ${s1}
|
|
|
30031
29627
|
}
|
|
30032
29628
|
for (let pIdx = 0; pIdx < clause.patterns.length; pIdx++) {
|
|
30033
29629
|
const pw = clause.patterns[pIdx];
|
|
30034
|
-
const pStr =
|
|
29630
|
+
const pStr = this.tryBuildSyncPatternWord(pw, state, originalIO, diagnosticLine);
|
|
30035
29631
|
if (pStr === void 0) {
|
|
30036
29632
|
allFast = false;
|
|
30037
29633
|
break;
|
|
@@ -31710,7 +31306,7 @@ ${s1}
|
|
|
31710
31306
|
}
|
|
31711
31307
|
}
|
|
31712
31308
|
const scope = io[invocationScope].child();
|
|
31713
|
-
const externalDef = typeof name2 === "string" ? this.
|
|
31309
|
+
const externalDef = typeof name2 === "string" ? this.commands.get(name2) : void 0;
|
|
31714
31310
|
const fastInline = !state.externalInvocation && this.middleware.length === 0 && typeof name2 === "string" && (!externalDef || !customRegisteredCommands.has(externalDef.execute) && !customRegisteredRegistries.has(this.commands)) && !(!bypassFunctions && state.functions.has(name2)) && !state.extensions?.builtins.has(name2) && name2 !== "." && name2 !== "source" && name2 !== "eval" && name2 !== "command" && name2 !== "builtin" && name2 !== "type" && name2 !== "read" && name2 !== "mapfile" && name2 !== "readarray";
|
|
31715
31311
|
if (fastInline && externalDef !== void 0 && values.every((value) => typeof value === "string") && !implementedBuiltins.has(name2) && !(name2 === "printf" && externalDef.execute === printfCommand.execute && args[0]?.startsWith("-v"))) {
|
|
31716
31312
|
try {
|
|
@@ -32158,7 +31754,7 @@ ${s1}
|
|
|
32158
31754
|
return { exitCode: builtin };
|
|
32159
31755
|
}
|
|
32160
31756
|
}
|
|
32161
|
-
const definition = this.
|
|
31757
|
+
const definition = this.commands.get(context2.command);
|
|
32162
31758
|
if (context2.command === "printf" && definition?.execute === printfCommand.execute && context2.args[0]?.startsWith("-v")) {
|
|
32163
31759
|
ensureRuntimeContext();
|
|
32164
31760
|
return { exitCode: await this.printfVariable(context2, state, assignments2) };
|
|
@@ -32235,7 +31831,7 @@ ${s1}
|
|
|
32235
31831
|
const matches = [];
|
|
32236
31832
|
if (!bypassFunctions && state.functions.has(name2)) matches.push({ kind: "function", name: name2 });
|
|
32237
31833
|
if (implementedBuiltins.has(name2) || state.extensions?.builtins.has(name2)) matches.push({ kind: "builtin", name: name2 });
|
|
32238
|
-
else if (this.
|
|
31834
|
+
else if (this.commands.has(name2)) matches.push({ kind: "command", name: name2 });
|
|
32239
31835
|
else if (name2 === "bash" || name2 === "sh") matches.push({ kind: "interpreter", name: name2 });
|
|
32240
31836
|
if (state.profile === "sh" && (specialBuiltinNames.has(name2) || state.extensions?.builtins.get(name2)?.special)) matches.sort((left, right) => Number(right.kind === "builtin") - Number(left.kind === "builtin"));
|
|
32241
31837
|
return matches;
|
|
@@ -32277,19 +31873,10 @@ ${s1}
|
|
|
32277
31873
|
if (isBuiltin && state.profile === "sh" && (specialBuiltinNames.has(name2) || state.extensions?.builtins.get(name2)?.special)) return "builtin";
|
|
32278
31874
|
if (!bypassFunctions && state.functions.has(name2)) return "function";
|
|
32279
31875
|
if (isBuiltin) return "builtin";
|
|
32280
|
-
if (this.
|
|
31876
|
+
if (this.commands.has(name2)) return "command";
|
|
32281
31877
|
if (name2 === "bash" || name2 === "sh") return "interpreter";
|
|
32282
31878
|
return void 0;
|
|
32283
31879
|
}
|
|
32284
|
-
getExternalCommand(name2) {
|
|
32285
|
-
const direct = this.commands.get(name2);
|
|
32286
|
-
if (direct) return direct;
|
|
32287
|
-
if (this.commands.has("rg") || this.commands.has("grep")) return getRuntimeMuscleMemoryCommand(name2);
|
|
32288
|
-
return void 0;
|
|
32289
|
-
}
|
|
32290
|
-
hasExternalCommand(name2) {
|
|
32291
|
-
return this.getExternalCommand(name2) !== void 0;
|
|
32292
|
-
}
|
|
32293
31880
|
async discoveryBuiltin(context, state, io, assignments2, inheritedDefaultPath = false) {
|
|
32294
31881
|
const args = [...context.args];
|
|
32295
31882
|
const command = context.command === "command";
|
|
@@ -35653,7 +35240,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
35653
35240
|
const name2 = this.referenceName(state, part.name);
|
|
35654
35241
|
const binding = arrayStore(state)?.get(name2);
|
|
35655
35242
|
const index = binding?.associative ? binding.keys.get("30")?.index ?? -1 : 0;
|
|
35656
|
-
retained = binding?.getValue(index) ?? stateMonitor(state)?.values.get(name2, value) ?? value;
|
|
35243
|
+
retained = name2 === "RANDOM" || name2 === "SECONDS" || name2 === "LINENO" ? value : binding?.getValue(index) ?? stateMonitor(state)?.values.get(name2, value) ?? value;
|
|
35657
35244
|
} else if (/^0+$/u.test(part.name)) retained = stateMonitor(state)?.positionals.get(zeroPositionKey, value) ?? value;
|
|
35658
35245
|
else if (/^[0-9]+$/u.test(part.name)) retained = stateMonitor(state)?.positionals.get(String(Number(part.name) - 1), value) ?? value;
|
|
35659
35246
|
else if (part.name === "@" || part.name === "*") {
|
|
@@ -35984,6 +35571,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
35984
35571
|
let out = "";
|
|
35985
35572
|
for (let i = 0; i < word.parts.length; i++) {
|
|
35986
35573
|
let resolvedPart = word.parts[i];
|
|
35574
|
+
if (resolvedPart.kind === "variable" && (resolveSyncNameref(rawState, resolvedPart.name) === "RANDOM" || resolveSyncNameref(rawState, resolvedPart.name) === "SECONDS")) return void 0;
|
|
35987
35575
|
if (resolvedPart.kind === "variable" && !resolvedPart.prefixNames && rawState.variableAttributes?.get(resolvedPart.name)?.includes("n")) {
|
|
35988
35576
|
if (resolvedPart.indirect) return void 0;
|
|
35989
35577
|
const resolvedName = resolveSyncNameref(rawState, resolvedPart.name);
|
|
@@ -36535,7 +36123,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
36535
36123
|
let trimGlobRe;
|
|
36536
36124
|
if (!patQuoted && hasGlobOrEscape(pat, !!rawState.extglob)) {
|
|
36537
36125
|
if (rawState.nocasematch || byteLocale(rawVars)) return void 0;
|
|
36538
|
-
if (isPrefixTrim && pat.charCodeAt(0) === 42 && !hasGlobOrEscape(pat.slice(1), !!rawState.extglob)) starWildcardLit = pat.slice(1);
|
|
36126
|
+
if (isPrefixTrim && pat.charCodeAt(0) === 42 && !(rawState.extglob && pat.charCodeAt(1) === 40) && !hasGlobOrEscape(pat.slice(1), !!rawState.extglob)) starWildcardLit = pat.slice(1);
|
|
36539
36127
|
else if (!isPrefixTrim && pat.charCodeAt(pat.length - 1) === 42 && !hasGlobOrEscape(pat.slice(0, -1), !!rawState.extglob)) starWildcardLit = pat.slice(0, -1);
|
|
36540
36128
|
else {
|
|
36541
36129
|
trimGlobRe = tryCompileTrimGlobToRegex(pat, part.operator, !!rawState.extglob);
|
|
@@ -36688,6 +36276,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
36688
36276
|
}
|
|
36689
36277
|
} else if (part.kind === "substitution") {
|
|
36690
36278
|
if (split && !part.quoted) return void 0;
|
|
36279
|
+
if (!this._syncLoopInvariantSubMap?.has(part)) return void 0;
|
|
36691
36280
|
const substVal = this.tryFastPureSubstitution(part, state, rawState, io);
|
|
36692
36281
|
if (substVal === void 0) return void 0;
|
|
36693
36282
|
out += substVal;
|
|
@@ -43736,7 +43325,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43736
43325
|
const p = word.parts[i];
|
|
43737
43326
|
if (p.kind === "text") continue;
|
|
43738
43327
|
if (p.kind === "variable") {
|
|
43739
|
-
if (p.name === "BASH_SUBSHELL") return false;
|
|
43328
|
+
if (p.name === "BASH_SUBSHELL" || p.name === "RANDOM" || p.name === "SECONDS") return false;
|
|
43740
43329
|
if (!p.indirect && !p.prefixNames && !p.length && !p.substring && !p.transform && p.operator === void 0 && getArraySelector(p) === void 0 && (p.name === "?" || p.name === "#" || p.name.length === 1 && p.name >= "1" && p.name <= "9")) {
|
|
43741
43330
|
const activePos = this._fastSubPositional ?? rawState.positional;
|
|
43742
43331
|
if (rawState.nounset && p.name >= "1" && p.name <= "9" && activePos[p.name.charCodeAt(0) - 49] === void 0) return false;
|
|
@@ -43750,15 +43339,14 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43750
43339
|
continue;
|
|
43751
43340
|
}
|
|
43752
43341
|
if (p.kind === "arithmetic") {
|
|
43753
|
-
|
|
43754
|
-
if (p.expression.error && (p.expression.source.includes("=") || p.expression.source.includes("++") || p.expression.source.includes("--"))) return false;
|
|
43755
|
-
continue;
|
|
43342
|
+
return false;
|
|
43756
43343
|
}
|
|
43757
43344
|
return false;
|
|
43758
43345
|
}
|
|
43759
43346
|
return true;
|
|
43760
43347
|
}
|
|
43761
43348
|
tryFastPureSubstitution(part, state, rawState, io) {
|
|
43349
|
+
if (this.budget.limits.maxInputBytes !== Infinity) return void 0;
|
|
43762
43350
|
const cachedInv = this._syncLoopInvariantSubMap?.get(part);
|
|
43763
43351
|
if (cachedInv !== void 0 && !cachedInv.dynamic) {
|
|
43764
43352
|
const nextTotalBytes = this.budget.bytes + cachedInv.outBytes;
|
|
@@ -43791,7 +43379,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43791
43379
|
const name2 = command.words[0]?.plain;
|
|
43792
43380
|
if (!name2) continue;
|
|
43793
43381
|
if (name2 === "fmt" && command === pipeline.commands[0] && command.redirects.length === 0 && !io.stdinIsDefault) return void 0;
|
|
43794
|
-
const definition = this.
|
|
43382
|
+
const definition = this.commands.get(name2);
|
|
43795
43383
|
if (definition && customRegisteredCommands.has(definition.execute)) return void 0;
|
|
43796
43384
|
if (name2 === "uname" || name2 === "nproc" || name2 === "hostname" || name2 === "id" || name2 === "whoami") {
|
|
43797
43385
|
if (!definition || !builtInDirectContextExecutors.has(definition.execute)) return void 0;
|
|
@@ -43814,7 +43402,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43814
43402
|
}
|
|
43815
43403
|
if (cmd0HereStringRedir && w0Plain0 === "cat" && cmd0.words.length !== 1) return void 0;
|
|
43816
43404
|
if (!cmd0StdinRedir && !cmd0HereStringRedir && w0Plain0 === "cat" && cmd0.words.length < 2) return void 0;
|
|
43817
|
-
const def0 =
|
|
43405
|
+
const def0 = this.commands.get(w0Plain0);
|
|
43818
43406
|
if (!def0 || (w0Plain0 === "printf" ? def0.execute !== printfCommand.execute : w0Plain0 === "echo" ? !defaultEchoExecutors.has(def0.execute) : w0Plain0 === "cat" || w0Plain0 === "seq" || cmd0YesStage || cmd0SysStage || cmd0StdinRedir || cmd0HereStringRedir || cmd0FileStage ? w0Plain0 !== "rev" && w0Plain0 !== "tac" && w0Plain0 !== "nl" && w0Plain0 !== "paste" && w0Plain0 !== "comm" && w0Plain0 !== "join" && w0Plain0 !== "jq" && w0Plain0 !== "strings" && w0Plain0 !== "bc" && w0Plain0 !== "factor" && w0Plain0 !== "tsort" && w0Plain0 !== "envsubst" && w0Plain0 !== "xxd" && w0Plain0 !== "od" && w0Plain0 !== "hexdump" && w0Plain0 !== "hd" && w0Plain0 !== "fmt" && w0Plain0 !== "md5sum" && w0Plain0 !== "sha1sum" && w0Plain0 !== "sha224sum" && w0Plain0 !== "sha256sum" && w0Plain0 !== "sha384sum" && w0Plain0 !== "sha512sum" && w0Plain0 !== "cksum" && w0Plain0 !== "base32" && w0Plain0 !== "base64" && w0Plain0 !== "csvcut" && w0Plain0 !== "csvgrep" && w0Plain0 !== "dos2unix" && w0Plain0 !== "unix2dos" && w0Plain0 !== "iconv" && w0Plain0 !== "gzip" && w0Plain0 !== "gunzip" && w0Plain0 !== "zcat" && w0Plain0 !== "unzstd" && w0Plain0 !== "zstdcat" && w0Plain0 !== "htmlq" && w0Plain0 !== "xmllint" && w0Plain0 !== "xq" && w0Plain0 !== "yq" && w0Plain0 !== "mdq" && w0Plain0 !== "shuf" && w0Plain0 !== "html-to-markdown" && w0Plain0 !== "unrtf" && w0Plain0 !== "pr" && w0Plain0 !== "file" && w0Plain0 !== "diff3" && w0Plain0 !== "cmp" && w0Plain0 !== "which" && w0Plain0 !== "diff" && w0Plain0 !== "xan" && w0Plain0 !== "less" && w0Plain0 !== "more" && w0Plain0 !== "df" && w0Plain0 !== "du" && w0Plain0 !== "tree" && w0Plain0 !== "stat" && w0Plain0 !== "fd" && w0Plain0 !== "rg" && w0Plain0 !== "readlink" && w0Plain0 !== "realpath" && w0Plain0 !== "ls" && w0Plain0 !== "find" && w0Plain0 !== "csvlook" && w0Plain0 !== "csvjson" && w0Plain0 !== "csvsort" && w0Plain0 !== "csvformat" && w0Plain0 !== "csvstat" && w0Plain0 !== "in2csv" && w0Plain0 !== "csvstack" && w0Plain0 !== "csvjoin" && w0Plain0 !== "dd" && w0Plain0 !== "env" && w0Plain0 !== "xargs" && w0Plain0 !== "openssl" && w0Plain0 !== "sqlite3" && w0Plain0 !== "gpg" && w0Plain0 !== "ssh" && w0Plain0 !== "ssh-keygen" && w0Plain0 !== "pdfinfo" && w0Plain0 !== "pdffonts" && w0Plain0 !== "pdftotext" && w0Plain0 !== "pdftohtml" && w0Plain0 !== "exiftool" && w0Plain0 !== "qpdf" && w0Plain0 !== "pdftk" && w0Plain0 !== "sips" && w0Plain0 !== "identify" && w0Plain0 !== "magick" && w0Plain0 !== "convert" && w0Plain0 !== "pdfimages" && w0Plain0 !== "pdfdetach" && w0Plain0 !== "ffprobe" && w0Plain0 !== "ffmpeg" && w0Plain0 !== "gh" && w0Plain0 !== "pdftoppm" && w0Plain0 !== "pdftocairo" && w0Plain0 !== "mmdc" && w0Plain0 !== "pandoc" && w0Plain0 !== "soffice" && w0Plain0 !== "libreoffice" && w0Plain0 !== "ssconvert" && w0Plain0 !== "wkhtmltopdf" && w0Plain0 !== "op" && w0Plain0 !== "date" && w0Plain0 !== "printenv" && w0Plain0 !== "egrep" && w0Plain0 !== "fgrep" && w0Plain0 !== "yes" && w0Plain0 !== "cal" && w0Plain0 !== "ncal" && w0Plain0 !== "expr" && w0Plain0 !== "getopt" && w0Plain0 !== "pathchk" && !builtInDirectContextExecutors.has(def0.execute) : customRegisteredCommands.has(def0.execute) || customRegisteredRegistries.has(this.commands))) return void 0;
|
|
43819
43407
|
if (!this.arePureArgWords(cmd0.words, rawState)) return void 0;
|
|
43820
43408
|
const n = pipeline.commands.length;
|
|
@@ -43827,7 +43415,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43827
43415
|
if (sCmd.kind !== "simple" || (i > 0 ? sCmd.redirects.length !== 0 : !cmd0StdinRedir && !cmd0HereStringRedir && !cmd0FileStage) || sCmd.words.length === 0) return void 0;
|
|
43828
43416
|
const sName = sCmd.words[0].plain;
|
|
43829
43417
|
if (!sName || hasShellFunction(rawState, sName) || rawState.extensions?.builtins.has(sName)) return void 0;
|
|
43830
|
-
const extDef = this.
|
|
43418
|
+
const extDef = this.commands.get(sName);
|
|
43831
43419
|
if (!extDef || (sName !== "cat" || startStageIdx === 0) && sName !== "rev" && sName !== "tac" && sName !== "nl" && sName !== "paste" && sName !== "column" && sName !== "fold" && sName !== "expand" && sName !== "unexpand" && sName !== "strings" && sName !== "comm" && sName !== "join" && sName !== "jq" && sName !== "bc" && sName !== "factor" && sName !== "tsort" && sName !== "envsubst" && sName !== "xxd" && sName !== "od" && sName !== "hexdump" && sName !== "hd" && sName !== "fmt" && sName !== "md5sum" && sName !== "sha1sum" && sName !== "sha224sum" && sName !== "sha256sum" && sName !== "sha384sum" && sName !== "sha512sum" && sName !== "cksum" && sName !== "base32" && sName !== "base64" && sName !== "csvcut" && sName !== "csvgrep" && sName !== "dos2unix" && sName !== "unix2dos" && sName !== "iconv" && sName !== "gzip" && sName !== "gunzip" && sName !== "zcat" && sName !== "unzstd" && sName !== "zstdcat" && sName !== "htmlq" && sName !== "xmllint" && sName !== "xq" && sName !== "yq" && sName !== "mdq" && sName !== "shuf" && sName !== "html-to-markdown" && sName !== "unrtf" && sName !== "pr" && sName !== "file" && sName !== "diff3" && sName !== "cmp" && sName !== "which" && sName !== "diff" && sName !== "xan" && sName !== "less" && sName !== "more" && sName !== "df" && sName !== "du" && sName !== "tree" && sName !== "stat" && sName !== "fd" && sName !== "rg" && sName !== "readlink" && sName !== "realpath" && sName !== "ls" && sName !== "find" && sName !== "csvlook" && sName !== "csvjson" && sName !== "csvsort" && sName !== "csvformat" && sName !== "csvstat" && sName !== "in2csv" && sName !== "csvstack" && sName !== "csvjoin" && sName !== "dd" && sName !== "xargs" && sName !== "openssl" && sName !== "sqlite3" && sName !== "gpg" && sName !== "ssh" && sName !== "ssh-keygen" && sName !== "pdfinfo" && sName !== "pdffonts" && sName !== "pdftotext" && sName !== "pdftohtml" && sName !== "exiftool" && sName !== "qpdf" && sName !== "pdftk" && sName !== "sips" && sName !== "identify" && sName !== "magick" && sName !== "convert" && sName !== "pdfimages" && sName !== "pdfdetach" && sName !== "ffprobe" && sName !== "ffmpeg" && sName !== "gh" && sName !== "pdftoppm" && sName !== "pdftocairo" && sName !== "mmdc" && sName !== "pandoc" && sName !== "soffice" && sName !== "libreoffice" && sName !== "ssconvert" && sName !== "wkhtmltopdf" && sName !== "op" && sName !== "date" && sName !== "cal" && sName !== "ncal" && sName !== "getopt" && sName !== "pathchk" && sName !== "printenv" && sName !== "env" && sName !== "egrep" && sName !== "fgrep" && !builtInDirectContextExecutors.has(extDef.execute) || customRegisteredCommands.has(extDef.execute)) return void 0;
|
|
43832
43420
|
if ((sName === "xxd" || sName === "od") && !builtInDirectContextExecutors.has(extDef.execute)) return void 0;
|
|
43833
43421
|
if (!this.arePureArgWords(sCmd.words, rawState)) return void 0;
|
|
@@ -44038,7 +43626,9 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44038
43626
|
}
|
|
44039
43627
|
if (stage0Formatted === void 0 || stage0Formatted.length > 8192) return void 0;
|
|
44040
43628
|
const stage0ByteLen = shellValueByteLength(stage0Formatted);
|
|
44041
|
-
if (stage0ByteLen >
|
|
43629
|
+
if (stage0ByteLen > 65536) return void 0;
|
|
43630
|
+
const sharedSyncPipeBuf0 = new Uint8Array(65536);
|
|
43631
|
+
const sharedSyncPipeBuf1 = new Uint8Array(65536);
|
|
44042
43632
|
const nextBytes0 = this.budget.bytes + stage0ByteLen;
|
|
44043
43633
|
if (nextBytes0 > this.budget.maxOutputBytesSmi && stage0ByteLen > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
44044
43634
|
const previousBytes = this.budget.bytes;
|
|
@@ -44758,7 +44348,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44758
44348
|
for (const cl of cmd.clauses) {
|
|
44759
44349
|
let matched = false;
|
|
44760
44350
|
for (const pw of cl.patterns) {
|
|
44761
|
-
if (pw.plain !== void 0 && tryMatchesPatternSync(pw.plain, subj, work, false, false) === true) {
|
|
44351
|
+
if (pw.plain !== void 0 && !pw.plain.startsWith("~") && tryMatchesPatternSync(pw.plain, subj, work, false, false) === true) {
|
|
44762
44352
|
matched = true;
|
|
44763
44353
|
break;
|
|
44764
44354
|
}
|
|
@@ -44783,19 +44373,19 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44783
44373
|
if (!w0Plain || rawState.extensions?.builtins.has(w0Plain)) return void 0;
|
|
44784
44374
|
if (w0Plain === "fmt" && !hasSingleStdinRedir && !hasSingleHereStringRedir && !io.stdinIsDefault) return void 0;
|
|
44785
44375
|
if (w0Plain === "xxd" || w0Plain === "od" || w0Plain === "mktemp" || w0Plain === "chmod" || w0Plain === "uname" || w0Plain === "nproc" || w0Plain === "hostname" || w0Plain === "id" || w0Plain === "whoami") {
|
|
44786
|
-
const definition = this.
|
|
44376
|
+
const definition = this.commands.get(w0Plain);
|
|
44787
44377
|
if (!definition || !builtInDirectContextExecutors.has(definition.execute)) return void 0;
|
|
44788
44378
|
}
|
|
44789
44379
|
if (cmd.words.length === 2 && cmd.redirects.length === 0 && (cmd.words[1]?.plain === "--help" || cmd.words[1]?.plain === "--version")) {
|
|
44790
44380
|
const gnuInfo = gnuInformationSync(w0Plain, [cmd.words[1].plain], false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== void 0);
|
|
44791
44381
|
if (gnuInfo !== void 0) {
|
|
44792
|
-
const extDef = this.
|
|
44382
|
+
const extDef = this.commands.get(w0Plain);
|
|
44793
44383
|
if (!extDef || !builtInDirectContextExecutors.has(extDef.execute)) return void 0;
|
|
44794
44384
|
return gnuInfo.replace(/\n+$/, "");
|
|
44795
44385
|
}
|
|
44796
44386
|
}
|
|
44797
44387
|
const isSingleFileTool = w0Plain === "cat" || w0Plain === "head" || w0Plain === "tail" || w0Plain === "jq" || w0Plain === "awk" || w0Plain === "grep" || w0Plain === "egrep" || w0Plain === "fgrep" || w0Plain === "sed" || w0Plain === "cut" || w0Plain === "wc" || w0Plain === "sort" || w0Plain === "uniq" || w0Plain === "tr" || (w0Plain === "base64" || w0Plain === "rev" || w0Plain === "tac" || w0Plain === "nl" || w0Plain === "paste" || w0Plain === "numfmt" || w0Plain === "column" || w0Plain === "fold" || w0Plain === "expand" || w0Plain === "unexpand" || w0Plain === "strings" || w0Plain === "comm" || w0Plain === "join") || w0Plain === "comm" || w0Plain === "join" || w0Plain === "paste" || w0Plain === "numfmt" || w0Plain === "nl" || w0Plain === "expr" || w0Plain === "bc" || w0Plain === "xxd" || w0Plain === "od" || w0Plain === "factor" || w0Plain === "tsort" || w0Plain === "envsubst" || w0Plain === "hexdump" || w0Plain === "hd" || w0Plain === "fmt" || w0Plain === "uname" || w0Plain === "id" || w0Plain === "whoami" || w0Plain === "hostname" || w0Plain === "nproc" || w0Plain === "getconf" || w0Plain === "locale" || w0Plain === "csvcut" || w0Plain === "csvgrep" || w0Plain === "getopt" || w0Plain === "dos2unix" || w0Plain === "unix2dos" || w0Plain === "iconv" || w0Plain === "gzip" || w0Plain === "gunzip" || w0Plain === "zcat" || w0Plain === "unzstd" || w0Plain === "zstdcat" || w0Plain === "zstd" || w0Plain === "bzip2" || w0Plain === "bunzip2" || w0Plain === "bzcat" || w0Plain === "xz" || w0Plain === "unxz" || w0Plain === "xzcat" || w0Plain === "lzma" || w0Plain === "unlzma" || w0Plain === "lzcat" || w0Plain === "htmlq" || w0Plain === "xmllint" || w0Plain === "xq" || w0Plain === "yq" || w0Plain === "mdq" || w0Plain === "shuf" || w0Plain === "html-to-markdown" || w0Plain === "unrtf" || w0Plain === "pr" || w0Plain === "pathchk" || w0Plain === "file" || w0Plain === "diff3" || w0Plain === "cmp" || w0Plain === "which" || w0Plain === "diff" || w0Plain === "xan" || w0Plain === "less" || w0Plain === "more" || w0Plain === "df" || w0Plain === "du" || w0Plain === "tree" || w0Plain === "stat" || w0Plain === "fd" || w0Plain === "rg" || w0Plain === "readlink" || w0Plain === "realpath" || w0Plain === "ls" || w0Plain === "find" || w0Plain === "csvlook" || w0Plain === "csvjson" || w0Plain === "csvsort" || w0Plain === "csvformat" || w0Plain === "csvstat" || w0Plain === "in2csv" || w0Plain === "csvstack" || w0Plain === "csvjoin" || w0Plain === "dd" || w0Plain === "env" || w0Plain === "xargs" || w0Plain === "openssl" || w0Plain === "sqlite3" || w0Plain === "gpg" || w0Plain === "ssh" || w0Plain === "ssh-keygen" || w0Plain === "pdfinfo" || w0Plain === "pdffonts" || w0Plain === "pdftotext" || w0Plain === "pdftohtml" || w0Plain === "exiftool" || w0Plain === "qpdf" || w0Plain === "pdftk" || w0Plain === "sips" || w0Plain === "identify" || w0Plain === "magick" || w0Plain === "convert" || w0Plain === "mogrify" || w0Plain === "composite" || w0Plain === "montage" || w0Plain === "compare" || w0Plain === "pdfimages" || w0Plain === "pdfdetach" || w0Plain === "ffprobe" || w0Plain === "ffmpeg" || w0Plain === "gh" || w0Plain === "pdftoppm" || w0Plain === "pdftocairo" || w0Plain === "mmdc" || w0Plain === "pandoc" || w0Plain === "soffice" || w0Plain === "libreoffice" || w0Plain === "ssconvert" || w0Plain === "wkhtmltopdf" || w0Plain === "op" || w0Plain === "git" || w0Plain === "tar" || w0Plain === "unzip" || w0Plain === "zip" || w0Plain === "timeout" || w0Plain === "split" || w0Plain === "csplit" || w0Plain === "curl" || w0Plain === "wget" || w0Plain === "sponge" || w0Plain === "truncate" || w0Plain === "install" || w0Plain === "apply_patch" || w0Plain === "mktemp" || w0Plain === "tee" || w0Plain === "touch" || w0Plain === "cp" || w0Plain === "mv" || w0Plain === "rmdir" || w0Plain === "sleep" || w0Plain === "chmod" || w0Plain === "patch" || w0Plain === "mkdir" || w0Plain === "rm" || w0Plain === "ln" || w0Plain === "date" || w0Plain === "printenv" || w0Plain === "egrep" || w0Plain === "fgrep" || w0Plain === "cal" || w0Plain === "ncal" || w0Plain === "md5sum" || w0Plain === "sha1sum" || w0Plain === "sha224sum" || w0Plain === "sha256sum" || w0Plain === "sha384sum" || w0Plain === "sha512sum" || w0Plain === "cksum" || w0Plain === "base32";
|
|
44798
|
-
if (isSingleFileTool && !hasShellFunction(rawState, w0Plain) && (this.commands.has(w0Plain) || (w0Plain === "base64" || w0Plain === "rev" || w0Plain === "tac" || w0Plain === "nl" || w0Plain === "paste" || w0Plain === "column" || w0Plain === "fold" || w0Plain === "expand" || w0Plain === "unexpand" || w0Plain === "strings" || w0Plain === "comm" || w0Plain === "join" || w0Plain === "expr" || w0Plain === "bc" || w0Plain === "xxd" || w0Plain === "od" || w0Plain === "factor" || w0Plain === "tsort" || w0Plain === "envsubst" || w0Plain === "hexdump" || w0Plain === "hd" || w0Plain === "fmt" || w0Plain === "uname" || w0Plain === "id" || w0Plain === "whoami" || w0Plain === "hostname" || w0Plain === "nproc" || w0Plain === "getconf" || w0Plain === "locale" || w0Plain === "csvcut" || w0Plain === "csvgrep" || w0Plain === "getopt" || w0Plain === "dos2unix" || w0Plain === "unix2dos" || w0Plain === "iconv" || w0Plain === "gzip" || w0Plain === "gunzip" || w0Plain === "zcat" || w0Plain === "unzstd" || w0Plain === "zstdcat" || w0Plain === "zstd" || w0Plain === "bzip2" || w0Plain === "bunzip2" || w0Plain === "bzcat" || w0Plain === "xz" || w0Plain === "unxz" || w0Plain === "xzcat" || w0Plain === "lzma" || w0Plain === "unlzma" || w0Plain === "lzcat" || w0Plain === "htmlq" || w0Plain === "xmllint" || w0Plain === "xq" || w0Plain === "yq" || w0Plain === "mdq" || w0Plain === "shuf" || w0Plain === "html-to-markdown" || w0Plain === "unrtf" || w0Plain === "pr" || w0Plain === "pathchk" || w0Plain === "file" || w0Plain === "diff3" || w0Plain === "cmp" || w0Plain === "which" || w0Plain === "diff" || w0Plain === "xan" || w0Plain === "less" || w0Plain === "more" || w0Plain === "df" || w0Plain === "du" || w0Plain === "tree" || w0Plain === "stat" || w0Plain === "fd" || w0Plain === "rg" || w0Plain === "readlink" || w0Plain === "realpath" || w0Plain === "ls" || w0Plain === "find" || w0Plain === "csvlook" || w0Plain === "csvjson" || w0Plain === "csvsort" || w0Plain === "csvformat" || w0Plain === "csvstat" || w0Plain === "in2csv" || w0Plain === "csvstack" || w0Plain === "csvjoin" || w0Plain === "dd" || w0Plain === "env" || w0Plain === "xargs" || w0Plain === "openssl" || w0Plain === "sqlite3" || w0Plain === "gpg" || w0Plain === "ssh" || w0Plain === "ssh-keygen" || w0Plain === "pdfinfo" || w0Plain === "pdffonts" || w0Plain === "pdftotext" || w0Plain === "pdftohtml" || w0Plain === "exiftool" || w0Plain === "qpdf" || w0Plain === "pdftk" || w0Plain === "sips" || w0Plain === "identify" || w0Plain === "magick" || w0Plain === "convert" || w0Plain === "mogrify" || w0Plain === "composite" || w0Plain === "montage" || w0Plain === "compare" || w0Plain === "pdfimages" || w0Plain === "pdfdetach" || w0Plain === "ffprobe" || w0Plain === "ffmpeg" || w0Plain === "gh" || w0Plain === "pdftoppm" || w0Plain === "pdftocairo" || w0Plain === "mmdc" || w0Plain === "pandoc" || w0Plain === "soffice" || w0Plain === "libreoffice" || w0Plain === "ssconvert" || w0Plain === "wkhtmltopdf" || w0Plain === "op" || w0Plain === "git" || w0Plain === "tar" || w0Plain === "unzip" || w0Plain === "zip" || w0Plain === "timeout" || w0Plain === "split" || w0Plain === "csplit" || w0Plain === "curl" || w0Plain === "wget" || w0Plain === "sponge" || w0Plain === "truncate" || w0Plain === "install" || w0Plain === "apply_patch" || w0Plain === "mktemp" || w0Plain === "tee" || w0Plain === "touch" || w0Plain === "cp" || w0Plain === "mv" || w0Plain === "rmdir" || w0Plain === "sleep" || w0Plain === "chmod" || w0Plain === "patch" || w0Plain === "mkdir" || w0Plain === "rm" || w0Plain === "ln" || w0Plain === "date" || w0Plain === "printenv" || w0Plain === "egrep" || w0Plain === "fgrep" || w0Plain === "cal" || w0Plain === "ncal" || w0Plain === "md5sum" || w0Plain === "sha1sum" || w0Plain === "sha224sum" || w0Plain === "sha256sum" || w0Plain === "sha384sum" || w0Plain === "sha512sum" || w0Plain === "cksum" || w0Plain === "base32") && Boolean(this.
|
|
44388
|
+
if (isSingleFileTool && !hasShellFunction(rawState, w0Plain) && (this.commands.has(w0Plain) || (w0Plain === "base64" || w0Plain === "rev" || w0Plain === "tac" || w0Plain === "nl" || w0Plain === "paste" || w0Plain === "column" || w0Plain === "fold" || w0Plain === "expand" || w0Plain === "unexpand" || w0Plain === "strings" || w0Plain === "comm" || w0Plain === "join" || w0Plain === "expr" || w0Plain === "bc" || w0Plain === "xxd" || w0Plain === "od" || w0Plain === "factor" || w0Plain === "tsort" || w0Plain === "envsubst" || w0Plain === "hexdump" || w0Plain === "hd" || w0Plain === "fmt" || w0Plain === "uname" || w0Plain === "id" || w0Plain === "whoami" || w0Plain === "hostname" || w0Plain === "nproc" || w0Plain === "getconf" || w0Plain === "locale" || w0Plain === "csvcut" || w0Plain === "csvgrep" || w0Plain === "getopt" || w0Plain === "dos2unix" || w0Plain === "unix2dos" || w0Plain === "iconv" || w0Plain === "gzip" || w0Plain === "gunzip" || w0Plain === "zcat" || w0Plain === "unzstd" || w0Plain === "zstdcat" || w0Plain === "zstd" || w0Plain === "bzip2" || w0Plain === "bunzip2" || w0Plain === "bzcat" || w0Plain === "xz" || w0Plain === "unxz" || w0Plain === "xzcat" || w0Plain === "lzma" || w0Plain === "unlzma" || w0Plain === "lzcat" || w0Plain === "htmlq" || w0Plain === "xmllint" || w0Plain === "xq" || w0Plain === "yq" || w0Plain === "mdq" || w0Plain === "shuf" || w0Plain === "html-to-markdown" || w0Plain === "unrtf" || w0Plain === "pr" || w0Plain === "pathchk" || w0Plain === "file" || w0Plain === "diff3" || w0Plain === "cmp" || w0Plain === "which" || w0Plain === "diff" || w0Plain === "xan" || w0Plain === "less" || w0Plain === "more" || w0Plain === "df" || w0Plain === "du" || w0Plain === "tree" || w0Plain === "stat" || w0Plain === "fd" || w0Plain === "rg" || w0Plain === "readlink" || w0Plain === "realpath" || w0Plain === "ls" || w0Plain === "find" || w0Plain === "csvlook" || w0Plain === "csvjson" || w0Plain === "csvsort" || w0Plain === "csvformat" || w0Plain === "csvstat" || w0Plain === "in2csv" || w0Plain === "csvstack" || w0Plain === "csvjoin" || w0Plain === "dd" || w0Plain === "env" || w0Plain === "xargs" || w0Plain === "openssl" || w0Plain === "sqlite3" || w0Plain === "gpg" || w0Plain === "ssh" || w0Plain === "ssh-keygen" || w0Plain === "pdfinfo" || w0Plain === "pdffonts" || w0Plain === "pdftotext" || w0Plain === "pdftohtml" || w0Plain === "exiftool" || w0Plain === "qpdf" || w0Plain === "pdftk" || w0Plain === "sips" || w0Plain === "identify" || w0Plain === "magick" || w0Plain === "convert" || w0Plain === "mogrify" || w0Plain === "composite" || w0Plain === "montage" || w0Plain === "compare" || w0Plain === "pdfimages" || w0Plain === "pdfdetach" || w0Plain === "ffprobe" || w0Plain === "ffmpeg" || w0Plain === "gh" || w0Plain === "pdftoppm" || w0Plain === "pdftocairo" || w0Plain === "mmdc" || w0Plain === "pandoc" || w0Plain === "soffice" || w0Plain === "libreoffice" || w0Plain === "ssconvert" || w0Plain === "wkhtmltopdf" || w0Plain === "op" || w0Plain === "git" || w0Plain === "tar" || w0Plain === "unzip" || w0Plain === "zip" || w0Plain === "timeout" || w0Plain === "split" || w0Plain === "csplit" || w0Plain === "curl" || w0Plain === "wget" || w0Plain === "sponge" || w0Plain === "truncate" || w0Plain === "install" || w0Plain === "apply_patch" || w0Plain === "mktemp" || w0Plain === "tee" || w0Plain === "touch" || w0Plain === "cp" || w0Plain === "mv" || w0Plain === "rmdir" || w0Plain === "sleep" || w0Plain === "chmod" || w0Plain === "patch" || w0Plain === "mkdir" || w0Plain === "rm" || w0Plain === "ln" || w0Plain === "date" || w0Plain === "printenv" || w0Plain === "egrep" || w0Plain === "fgrep" || w0Plain === "cal" || w0Plain === "ncal" || w0Plain === "md5sum" || w0Plain === "sha1sum" || w0Plain === "sha224sum" || w0Plain === "sha256sum" || w0Plain === "sha384sum" || w0Plain === "sha512sum" || w0Plain === "cksum" || w0Plain === "base32") && Boolean(this.commands.get(w0Plain)))) {
|
|
44799
44389
|
const allArgs = [];
|
|
44800
44390
|
let fOk = true;
|
|
44801
44391
|
for (let i = 1; i < cmd.words.length; i++) {
|
|
@@ -44909,7 +44499,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44909
44499
|
}
|
|
44910
44500
|
}
|
|
44911
44501
|
if (fOk && (w0Plain === "date" || w0Plain === "printenv" || w0Plain === "env") && !hasSingleStdinRedir && !hasSingleHereStringRedir) {
|
|
44912
|
-
const ext = this.
|
|
44502
|
+
const ext = this.commands.get(w0Plain);
|
|
44913
44503
|
const dpOut = w0Plain === "date" ? evalSyncDate(allArgs, rawState.exported.has("TZ") ? rawState.variables.TZ : void 0, ext?.execute, (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true), (p) => this.tryInspectMemoryNodeSync(resolvePath(rawState.cwd, p), true, true)?.mtimeMs) : w0Plain === "env" ? evalSyncEnv(allArgs, rawState.exported, rawState.variables) : evalSyncPrintenv(allArgs, rawState.exported, rawState.variables, ext?.execute);
|
|
44914
44504
|
if (dpOut !== void 0 && !dpOut.includes("\0")) {
|
|
44915
44505
|
let res = dpOut;
|
|
@@ -44929,7 +44519,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44929
44519
|
if (fOk && (w0Plain === "df" || w0Plain === "du" || w0Plain === "tree" || w0Plain === "stat" || w0Plain === "fd" || w0Plain === "readlink" || w0Plain === "realpath" || w0Plain === "ls" || w0Plain === "find") && !hasSingleStdinRedir && !hasSingleHereStringRedir) {
|
|
44930
44520
|
const inspectNode = (p) => this.tryInspectMemoryNodeSync(p, true);
|
|
44931
44521
|
const inspectStat = (p, follow) => this.tryInspectMemoryNodeSync(p, true, follow);
|
|
44932
|
-
const vfsOut = w0Plain === "df" ? evalSyncDf(allArgs, rawState.cwd, rawState.variables, inspectNode, this.
|
|
44522
|
+
const vfsOut = w0Plain === "df" ? evalSyncDf(allArgs, rawState.cwd, rawState.variables, inspectNode, this.commands.get("df")?.execute) : w0Plain === "du" ? evalSyncDu(allArgs, rawState.cwd, rawState.variables, inspectNode) : w0Plain === "tree" ? evalSyncTree(allArgs, rawState.cwd, inspectNode) : w0Plain === "stat" ? evalSyncStat(allArgs, rawState.cwd, rawState.variables.QUOTING_STYLE, inspectStat) : w0Plain === "fd" ? evalSyncFd(allArgs, rawState.cwd, inspectNode) : w0Plain === "readlink" ? evalSyncReadlink(allArgs, rawState.cwd, inspectStat) : w0Plain === "realpath" ? evalSyncRealpath(allArgs, rawState.cwd, inspectStat) : w0Plain === "find" ? evalSyncFind(allArgs, rawState.cwd, inspectStat) : evalSyncLs(allArgs, rawState.cwd, inspectStat);
|
|
44933
44523
|
if (vfsOut !== void 0 && !vfsOut.includes("\0")) {
|
|
44934
44524
|
let res = vfsOut;
|
|
44935
44525
|
const outBytes = shellValueByteLength(res);
|
|
@@ -45107,7 +44697,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45107
44697
|
} catch {
|
|
45108
44698
|
return false;
|
|
45109
44699
|
}
|
|
45110
|
-
}) : w0Plain === "gh" ? syncCommandEvaluators.evalSyncGh?.(this.
|
|
44700
|
+
}) : w0Plain === "gh" ? syncCommandEvaluators.evalSyncGh?.(this.commands.get("gh").execute, allArgs, rawState.variables, rawState.cwd, readFile) : w0Plain === "pdftoppm" ? syncCommandEvaluators.evalSyncPdftoppm?.(optInBytes, allArgs, readFile, (p, b) => {
|
|
45111
44701
|
try {
|
|
45112
44702
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45113
44703
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45157,7 +44747,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45157
44747
|
} catch {
|
|
45158
44748
|
return false;
|
|
45159
44749
|
}
|
|
45160
|
-
}) : w0Plain === "ssconvert" ? syncCommandEvaluators.evalSyncSsconvert?.(this.
|
|
44750
|
+
}) : w0Plain === "ssconvert" ? syncCommandEvaluators.evalSyncSsconvert?.(this.commands.get("ssconvert").execute, allArgs, optInBytes, readFile, (p, b) => {
|
|
45161
44751
|
try {
|
|
45162
44752
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45163
44753
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45177,7 +44767,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45177
44767
|
} catch {
|
|
45178
44768
|
return false;
|
|
45179
44769
|
}
|
|
45180
|
-
}) : w0Plain === "op" ? syncCommandEvaluators.evalSyncOp?.(this.
|
|
44770
|
+
}) : w0Plain === "op" ? syncCommandEvaluators.evalSyncOp?.(this.commands.get("op").execute, allArgs, rawState.variables) : w0Plain === "git" ? syncCommandEvaluators.evalSyncGit?.(optInBytes, allArgs, rawState.cwd, (p, follow) => this.tryInspectMemoryNodeSync(p, p === "/", follow), (p) => this.tryReadMemoryFileViewSync(p, false, true), this.commands.get("git").execute, (p, b, m) => {
|
|
45181
44771
|
try {
|
|
45182
44772
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45183
44773
|
const dir = p.slice(0, p.lastIndexOf("/")) || "/";
|
|
@@ -45835,7 +45425,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45835
45425
|
}
|
|
45836
45426
|
});
|
|
45837
45427
|
} else if (w0Plain === "gh") {
|
|
45838
|
-
fileRes = syncCommandEvaluators.evalSyncGh?.(this.
|
|
45428
|
+
fileRes = syncCommandEvaluators.evalSyncGh?.(this.commands.get("gh").execute, opArgs, rawState.variables, rawState.cwd, (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), false));
|
|
45839
45429
|
} else if (w0Plain === "pdftoppm") {
|
|
45840
45430
|
const readFile = (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true);
|
|
45841
45431
|
fileRes = syncCommandEvaluators.evalSyncPdftoppm?.(view, opArgs, readFile, (p, b) => {
|
|
@@ -45902,7 +45492,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45902
45492
|
}
|
|
45903
45493
|
});
|
|
45904
45494
|
} else if (w0Plain === "ssconvert") {
|
|
45905
|
-
fileRes = syncCommandEvaluators.evalSyncSsconvert?.(this.
|
|
45495
|
+
fileRes = syncCommandEvaluators.evalSyncSsconvert?.(this.commands.get("ssconvert").execute, opArgs, view, (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true), (p, b) => {
|
|
45906
45496
|
try {
|
|
45907
45497
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45908
45498
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45927,9 +45517,9 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45927
45517
|
}
|
|
45928
45518
|
});
|
|
45929
45519
|
} else if (w0Plain === "op") {
|
|
45930
|
-
fileRes = syncCommandEvaluators.evalSyncOp?.(this.
|
|
45520
|
+
fileRes = syncCommandEvaluators.evalSyncOp?.(this.commands.get("op").execute, opArgs, rawState.variables);
|
|
45931
45521
|
} else if (w0Plain === "git") {
|
|
45932
|
-
fileRes = syncCommandEvaluators.evalSyncGit?.(view, opArgs, rawState.cwd, (p, follow) => this.tryInspectMemoryNodeSync(p, p === "/", follow), (p) => this.tryReadMemoryFileViewSync(p, false, true), this.
|
|
45522
|
+
fileRes = syncCommandEvaluators.evalSyncGit?.(view, opArgs, rawState.cwd, (p, follow) => this.tryInspectMemoryNodeSync(p, p === "/", follow), (p) => this.tryReadMemoryFileViewSync(p, false, true), this.commands.get("git").execute, (p, b, m) => {
|
|
45933
45523
|
try {
|
|
45934
45524
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45935
45525
|
const dir = p.slice(0, p.lastIndexOf("/")) || "/";
|
|
@@ -46336,6 +45926,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46336
45926
|
}
|
|
46337
45927
|
let fnPositional;
|
|
46338
45928
|
if (rawState.functions.has(w0Plain)) {
|
|
45929
|
+
if (rawState.functionDepth >= this.budget.limits.maxFunctionDepth) return void 0;
|
|
46339
45930
|
if (rawState.depth + 1 >= this.budget.limits.maxSubstitutionDepth) return void 0;
|
|
46340
45931
|
const fnBody = rawState.functions.get(w0Plain);
|
|
46341
45932
|
if (fnBody.kind !== "group" || fnBody.redirects.length !== 0) return void 0;
|
|
@@ -46365,7 +45956,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46365
45956
|
const disc = typeof targetName === "string" ? this.tryResolveSyncDiscovery(w0Plain === "command" ? "name" : "kind", targetName, rawState) : void 0;
|
|
46366
45957
|
if (disc !== void 0 && (disc.status === 0 || !rawState.errexit)) {
|
|
46367
45958
|
if (disc.status === 0) {
|
|
46368
|
-
const byteLength2 =
|
|
45959
|
+
const byteLength2 = shellValueByteLength(disc.text) + 1;
|
|
46369
45960
|
const nextBytes2 = this.budget.bytes + byteLength2;
|
|
46370
45961
|
if (nextBytes2 > this.budget.maxOutputBytesSmi && byteLength2 > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
46371
45962
|
this.budget.bytes = nextBytes2;
|
|
@@ -46380,7 +45971,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46380
45971
|
if (w0Plain === "pwd" && (cmd.words.length === 1 || cmd.words.length === 2 && (cmd.words[1]?.plain === "-L" || cmd.words[1]?.plain === "--logical")) && !hasShellFunction(rawState, "pwd") && !rawState.extensions?.builtins.has("pwd")) {
|
|
46381
45972
|
let res = rawState.cwd;
|
|
46382
45973
|
while (res.endsWith("\n")) res = res.slice(0, -1);
|
|
46383
|
-
const byteLength2 =
|
|
45974
|
+
const byteLength2 = shellValueByteLength(res) + 1;
|
|
46384
45975
|
const nextBytes2 = this.budget.bytes + byteLength2;
|
|
46385
45976
|
if (nextBytes2 > this.budget.maxOutputBytesSmi && byteLength2 > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
46386
45977
|
this.budget.bytes = nextBytes2;
|
|
@@ -46391,7 +45982,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46391
45982
|
return res;
|
|
46392
45983
|
}
|
|
46393
45984
|
if (w0Plain !== "printf" && w0Plain !== "echo" && w0Plain !== "dirname" && w0Plain !== "basename" && w0Plain !== "seq") return void 0;
|
|
46394
|
-
const def =
|
|
45985
|
+
const def = this.commands.get(w0Plain);
|
|
46395
45986
|
if (!def) return void 0;
|
|
46396
45987
|
if (w0Plain === "printf" && def.execute !== printfCommand.execute) return void 0;
|
|
46397
45988
|
if (w0Plain === "echo" && !defaultEchoExecutors.has(def.execute)) return void 0;
|
|
@@ -47296,6 +46887,7 @@ var RootShellState = class {
|
|
|
47296
46887
|
this.status = 0;
|
|
47297
46888
|
this.substitutionStatus = 0;
|
|
47298
46889
|
this.lastArgument = "";
|
|
46890
|
+
this.secondsOrigin = Date.now();
|
|
47299
46891
|
}
|
|
47300
46892
|
get exported() {
|
|
47301
46893
|
const raw = stateMonitor(this)?.raw;
|
|
@@ -47611,8 +47203,6 @@ var EMPTY_CAPTURED_EXTENSIONS = captureShellExtensions([]);
|
|
|
47611
47203
|
var sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
47612
47204
|
var sharedUtf8Encoder = new TextEncoder();
|
|
47613
47205
|
var EMPTY_SHELL_BYTES = new Uint8Array(0);
|
|
47614
|
-
var _cachedFastResultStdout = "\0";
|
|
47615
|
-
var _cachedFastResultPromise;
|
|
47616
47206
|
var FastShellResult = class {
|
|
47617
47207
|
constructor(stdout, stderr, exitCode) {
|
|
47618
47208
|
this.stdout = typeof stdout === "string" ? stdout : sharedUtf8Decoder.decode(stdout);
|
|
@@ -47648,7 +47238,6 @@ var EMPTY_STDIN_OPTIONS = Object.freeze({
|
|
|
47648
47238
|
});
|
|
47649
47239
|
var EMPTY_EXEC_OPTIONS = Object.freeze({});
|
|
47650
47240
|
var EMPTY_STDOUT_BYTES = new Uint8Array(0);
|
|
47651
|
-
var _execAnchor = new Array(13);
|
|
47652
47241
|
var warmSyncExecJitWarmed = false;
|
|
47653
47242
|
var parsedSourceCache = /* @__PURE__ */ new Map();
|
|
47654
47243
|
var lastSourceCacheKey = "";
|
|
@@ -48176,30 +47765,6 @@ var Shell = class _Shell {
|
|
|
48176
47765
|
void scope.close();
|
|
48177
47766
|
}
|
|
48178
47767
|
cancellationState.close();
|
|
48179
|
-
if (_execAnchor[10] === void 0) {
|
|
48180
|
-
_execAnchor[10] = ensureStateMonitor(currentState, budget, scope);
|
|
48181
|
-
}
|
|
48182
|
-
if (source.length > 0) {
|
|
48183
|
-
_execAnchor[0] = budget;
|
|
48184
|
-
_execAnchor[1] = scope;
|
|
48185
|
-
_execAnchor[2] = cancellationState;
|
|
48186
|
-
_execAnchor[3] = owner;
|
|
48187
|
-
_execAnchor[4] = warm.admission;
|
|
48188
|
-
_execAnchor[5] = warm.boundary;
|
|
48189
|
-
_execAnchor[6] = stdout;
|
|
48190
|
-
_execAnchor[7] = stderr;
|
|
48191
|
-
_execAnchor[8] = io;
|
|
48192
|
-
_execAnchor[9] = currentState;
|
|
48193
|
-
_execAnchor[11] = runtime;
|
|
48194
|
-
}
|
|
48195
|
-
if (exitCode === 0 && stderrOutput === "" && typeof stdoutOutput === "string") {
|
|
48196
|
-
if (stdoutOutput === _cachedFastResultStdout && _cachedFastResultPromise !== void 0) {
|
|
48197
|
-
return _cachedFastResultPromise;
|
|
48198
|
-
}
|
|
48199
|
-
_cachedFastResultStdout = stdoutOutput;
|
|
48200
|
-
_cachedFastResultPromise = Promise.resolve(new FastShellResult(stdoutOutput, "", 0));
|
|
48201
|
-
return _cachedFastResultPromise;
|
|
48202
|
-
}
|
|
48203
47768
|
return Promise.resolve(new FastShellResult(stdoutOutput, stderrOutput, exitCode));
|
|
48204
47769
|
} catch (error) {
|
|
48205
47770
|
return this.#failWarmAsync(warm, error);
|
|
@@ -48525,6 +48090,7 @@ var Shell = class _Shell {
|
|
|
48525
48090
|
}
|
|
48526
48091
|
variables.OPTIND = "1";
|
|
48527
48092
|
variables.OPTERR = "1";
|
|
48093
|
+
variables.IFS ??= " \n";
|
|
48528
48094
|
currentState = new RootShellState(
|
|
48529
48095
|
cwd,
|
|
48530
48096
|
variables,
|
|
@@ -48655,7 +48221,7 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
48655
48221
|
void monitor.proxy.variables;
|
|
48656
48222
|
monitor.values.prewarm();
|
|
48657
48223
|
stdout.enableScratchBuffer();
|
|
48658
|
-
stderr.enableScratchBuffer(
|
|
48224
|
+
stderr.enableScratchBuffer();
|
|
48659
48225
|
void runtime.canFastMemoryRedirect;
|
|
48660
48226
|
preverifyMemoryRgTree(runtime.backingFs);
|
|
48661
48227
|
this.#warmedInvocation = {
|
|
@@ -48727,9 +48293,6 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
48727
48293
|
dispose() {
|
|
48728
48294
|
if (this.#disposal) return this.#disposal;
|
|
48729
48295
|
this.#disposed = true;
|
|
48730
|
-
_execAnchor.fill(void 0);
|
|
48731
|
-
_cachedFastResultStdout = "\0";
|
|
48732
|
-
_cachedFastResultPromise = void 0;
|
|
48733
48296
|
Runtime.clearStaticPools();
|
|
48734
48297
|
clearAwkReaderPool();
|
|
48735
48298
|
clearRgFastRunnerPool();
|