@poe-platform/safe-bash 0.1.800 → 0.1.802
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 +122 -76
- package/dist/image-ast/index.js +122 -76
- package/dist/pdf-ast/index.js +4 -3
- package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
- 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-K4YMYFRJ.js → chunk-44ALJ4QG.js} +5809 -7424
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
- package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
- package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
- 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-7ZBU7KYV.js +14 -0
- 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-QVSRRNZT.js → chunk-BJA5XNP6.js} +6 -6
- 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-DQP3VHSB.js +15 -0
- 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-FZE4HW6G.js +11 -0
- package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
- package/dist/safe-bash/chunks/{chunk-HHW7MGS2.js → chunk-GETUOD5D.js} +4 -4
- package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
- package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
- package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-HZAMGT5I.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.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-KDNSPLII.js +83 -0
- 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-KW24TAIU.js → chunk-NQCM3TYR.js} +922 -658
- 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-TYD7EVUJ.js → chunk-PH63PLPZ.js} +8 -8
- package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
- package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
- package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
- package/dist/safe-bash/chunks/{chunk-RKKRJ54E.js → chunk-RSTHLAF3.js} +30 -23
- package/dist/safe-bash/chunks/{chunk-RMWLWH7Q.js → chunk-SHEMU2Z7.js} +378 -1148
- 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-6HZYFL3H.js → chunk-VKNVHEX3.js} +2 -7
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
- package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JTLSUJ7V.js → chunk-WDLGKIHD.js} +56 -39
- package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
- 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-SAMH7SQE.js → chunk-6GWJUQAV.js} +237 -145
- 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-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-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-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -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-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
- 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-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
- 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-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-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-N2F74VRO.js → chunk-VT6MJBEI.js} +1 -1
- 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-HLGKIZ25.js → chunk-X54L3DBL.js} +6 -9
- 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-T5H5UJQ3.js → chunk-YVNGTIJO.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/apply-patch/index.browser.js +14 -0
- package/dist/safe-bash/commands/archive/index.browser.js +36 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +3 -2
- package/dist/safe-bash/commands/column/index.browser.js +12 -0
- 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/du/index.browser.js +14 -0
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/expr/index.browser.js +12 -0
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/file/index.browser.js +14 -0
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +26 -15
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
- 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/metadata/index.browser.js +21 -0
- 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 +8 -6
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- package/dist/safe-bash/commands/split/index.browser.js +14 -0
- package/dist/safe-bash/commands/standard.d.ts +1 -0
- package/dist/safe-bash/commands/standard.js +2 -1
- package/dist/safe-bash/commands/stream-format/index.browser.js +11 -0
- package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
- package/dist/safe-bash/commands/streams.js +11 -29
- package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
- package/dist/safe-bash/commands/text.js +269 -496
- package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
- package/dist/safe-bash/commands/tree/index.browser.js +14 -0
- 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 +308 -295
- 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 +15 -15
- 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 +41 -27
- package/dist/safe-bash/registry-entry.browser.js +42 -28
- package/dist/safe-bash/search.browser.js +48 -0
- 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 -13
- package/dist/safe-bash/shell/runtime.js +334 -1049
- package/dist/safe-bash/shell/shell.js +2 -54
- package/dist/safe-bash/shell-entry.browser.js +35 -26
- 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-nl/index.js +1 -1
- package/dist/safe-bash-command-nl/nl.js +1 -1
- 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-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
- package/dist/safe-bash-command-rg/rg-command.js +3 -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-unexpand/index.js +1 -1
- package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
- 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 +286 -90
- 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 -1
- 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 +68 -12
- 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,42 +1,16 @@
|
|
|
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
|
-
abortManagedController,
|
|
12
|
-
addAbortSignalWaiter,
|
|
13
11
|
bindFileOutputBudget,
|
|
14
12
|
clearRgFastRunnerPool,
|
|
15
|
-
combineManagedSignals,
|
|
16
|
-
createBcCommands,
|
|
17
|
-
createCalCommands,
|
|
18
|
-
createDdCommands,
|
|
19
|
-
createDfCommands,
|
|
20
|
-
createEnvsubstCommands,
|
|
21
|
-
createFdCommands,
|
|
22
13
|
createFmtEngine,
|
|
23
|
-
createGetconfCommands,
|
|
24
|
-
createHostnameCommands,
|
|
25
|
-
createIdCommands,
|
|
26
|
-
createLessCommands,
|
|
27
|
-
createLocaleCommands,
|
|
28
|
-
createManagedControlController,
|
|
29
|
-
createNprocCommands,
|
|
30
|
-
createNumfmtCommands,
|
|
31
|
-
createPathchkCommands,
|
|
32
|
-
createShufCommands,
|
|
33
|
-
createSpongeCommands,
|
|
34
|
-
createSqlite3Commands,
|
|
35
|
-
createStreamFormatCommands,
|
|
36
|
-
createStreamInspectionCommands,
|
|
37
|
-
createUnameCommands,
|
|
38
|
-
createWhoamiCommands,
|
|
39
|
-
creationUmask,
|
|
40
14
|
defaultEchoExecutors,
|
|
41
15
|
defaultMkdirExecutors,
|
|
42
16
|
defaultPredicateExecutors,
|
|
@@ -45,79 +19,55 @@ import {
|
|
|
45
19
|
evalSyncChecksum,
|
|
46
20
|
evalSyncCmp,
|
|
47
21
|
evalSyncCompression,
|
|
48
|
-
evalSyncDate,
|
|
49
22
|
evalSyncDf,
|
|
50
23
|
evalSyncDiff,
|
|
51
|
-
evalSyncDu,
|
|
52
24
|
evalSyncEnv,
|
|
53
25
|
evalSyncFd,
|
|
54
|
-
evalSyncFile,
|
|
55
26
|
evalSyncFind,
|
|
56
|
-
evalSyncHtmlToMarkdown,
|
|
57
27
|
evalSyncLess,
|
|
58
28
|
evalSyncLs,
|
|
59
29
|
evalSyncPathchk,
|
|
60
|
-
evalSyncPrintenv,
|
|
61
30
|
evalSyncReadlink,
|
|
62
31
|
evalSyncRealpath,
|
|
63
|
-
evalSyncStat,
|
|
64
|
-
evalSyncTar,
|
|
65
|
-
evalSyncTree,
|
|
66
|
-
evalSyncUnzip,
|
|
67
32
|
evalSyncWhich,
|
|
68
33
|
evalSyncXargs,
|
|
69
|
-
evalSyncZip,
|
|
70
34
|
evaluateFilePredicate,
|
|
71
35
|
executionCommands,
|
|
72
36
|
extractFastPrintfSpecifiers,
|
|
73
37
|
formatPrintf,
|
|
74
|
-
getRuntimeBackingFileSystem,
|
|
75
|
-
gnuInformationSync,
|
|
76
|
-
interruptible,
|
|
77
|
-
isManagedAbortSignal,
|
|
78
|
-
isSyncResolved,
|
|
79
38
|
openFileOutput,
|
|
80
39
|
parseFmtArguments,
|
|
81
|
-
preverifyMemoryRgTree,
|
|
82
40
|
printfCommand,
|
|
83
|
-
registerManagedAbortSignal,
|
|
84
|
-
removeAbortSignalWaiter,
|
|
85
41
|
tryFastEcho,
|
|
86
42
|
tryFastPredicate,
|
|
87
43
|
tryFastPrintf,
|
|
88
44
|
variablePresence,
|
|
89
45
|
wcDisplayWidth
|
|
90
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-44ALJ4QG.js";
|
|
91
47
|
import {
|
|
92
48
|
evalSyncGetopt
|
|
93
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-AUSNDQTJ.js";
|
|
94
50
|
import {
|
|
95
51
|
evalSyncIconv
|
|
96
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-CTVWDACF.js";
|
|
97
53
|
import {
|
|
98
54
|
evalSyncLineEndings
|
|
99
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-3R3AANOR.js";
|
|
100
56
|
import {
|
|
101
57
|
evalSyncMdq
|
|
102
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-OV6IHKO6.js";
|
|
103
59
|
import {
|
|
104
60
|
evalSyncXmllint,
|
|
105
61
|
evalSyncXq
|
|
106
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-C5OWC2TL.js";
|
|
107
63
|
import {
|
|
108
64
|
PublicDiagnostic,
|
|
109
65
|
publicDiagnosticMessage,
|
|
110
66
|
writeDiagnostic
|
|
111
|
-
} from "./chunk-
|
|
112
|
-
import {
|
|
113
|
-
bytesToHex,
|
|
114
|
-
compareUtf8,
|
|
115
|
-
latin1Bytes,
|
|
116
|
-
latin1Text
|
|
117
|
-
} from "./chunk-BHJE5LPZ.js";
|
|
67
|
+
} from "./chunk-PH63PLPZ.js";
|
|
118
68
|
import {
|
|
119
69
|
evalSyncPr
|
|
120
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-CHYGPFVM.js";
|
|
121
71
|
import {
|
|
122
72
|
EreLedger,
|
|
123
73
|
EreProfileLimitError,
|
|
@@ -127,10 +77,10 @@ import {
|
|
|
127
77
|
matchEre,
|
|
128
78
|
tryCompileEreSync,
|
|
129
79
|
tryMatchEreSync
|
|
130
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-6O77NL2S.js";
|
|
131
81
|
import {
|
|
132
82
|
jobsExtension
|
|
133
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-BJA5XNP6.js";
|
|
134
84
|
import {
|
|
135
85
|
concatShellValues,
|
|
136
86
|
shellValueByteLength,
|
|
@@ -138,14 +88,54 @@ import {
|
|
|
138
88
|
shellValueFromBytes,
|
|
139
89
|
shellValueRetainedBytes,
|
|
140
90
|
shellValueText
|
|
141
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-J42RIHHJ.js";
|
|
142
92
|
import {
|
|
143
93
|
openCommandFile
|
|
144
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-I5HZ4FGE.js";
|
|
95
|
+
import {
|
|
96
|
+
CommandRegistry,
|
|
97
|
+
commandRuntimeIdentity,
|
|
98
|
+
createCommandArguments,
|
|
99
|
+
getCommandArguments,
|
|
100
|
+
validateExitCode
|
|
101
|
+
} from "./chunk-7R5BDCG7.js";
|
|
102
|
+
import {
|
|
103
|
+
evalSyncTree
|
|
104
|
+
} from "./chunk-55YJASTN.js";
|
|
105
|
+
import {
|
|
106
|
+
evalSyncFile
|
|
107
|
+
} from "./chunk-4BSJLKNM.js";
|
|
108
|
+
import {
|
|
109
|
+
evalSyncHtmlToMarkdown
|
|
110
|
+
} from "./chunk-DQP3VHSB.js";
|
|
111
|
+
import {
|
|
112
|
+
evalSyncDu
|
|
113
|
+
} from "./chunk-GEG3BWGE.js";
|
|
114
|
+
import {
|
|
115
|
+
abortManagedController,
|
|
116
|
+
addAbortSignalWaiter,
|
|
117
|
+
combineManagedSignals,
|
|
118
|
+
createManagedControlController,
|
|
119
|
+
creationUmask,
|
|
120
|
+
evalSyncStat,
|
|
121
|
+
getRuntimeBackingFileSystem,
|
|
122
|
+
gnuInformationSync,
|
|
123
|
+
interruptible,
|
|
124
|
+
isManagedAbortSignal,
|
|
125
|
+
isSyncResolved,
|
|
126
|
+
registerManagedAbortSignal,
|
|
127
|
+
removeAbortSignalWaiter
|
|
128
|
+
} from "./chunk-VSAJ4OTM.js";
|
|
129
|
+
import {
|
|
130
|
+
bytesToHex,
|
|
131
|
+
compareUtf8,
|
|
132
|
+
latin1Bytes,
|
|
133
|
+
latin1Text
|
|
134
|
+
} from "./chunk-D3ANYGMC.js";
|
|
145
135
|
import {
|
|
146
136
|
FsError,
|
|
147
137
|
isFsError
|
|
148
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-VTH3MLDU.js";
|
|
149
139
|
import {
|
|
150
140
|
basename,
|
|
151
141
|
cancelTurn,
|
|
@@ -160,7 +150,7 @@ import {
|
|
|
160
150
|
runYieldCheckpoint,
|
|
161
151
|
scheduleTurn,
|
|
162
152
|
yieldTurn
|
|
163
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-NZQXYWA3.js";
|
|
164
154
|
import {
|
|
165
155
|
createBytePipe,
|
|
166
156
|
outputFailure,
|
|
@@ -168,14 +158,16 @@ import {
|
|
|
168
158
|
toByteSource,
|
|
169
159
|
writeBytes,
|
|
170
160
|
writeText
|
|
171
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-74GHTNJA.js";
|
|
172
162
|
import {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
evalSyncTar,
|
|
164
|
+
evalSyncUnzip,
|
|
165
|
+
evalSyncZip
|
|
166
|
+
} from "./chunk-QGUV42T5.js";
|
|
167
|
+
import {
|
|
168
|
+
evalSyncDate,
|
|
169
|
+
evalSyncPrintenv
|
|
170
|
+
} from "./chunk-ZVD5IS4V.js";
|
|
179
171
|
import {
|
|
180
172
|
RESOLVED_EXIT_ONE,
|
|
181
173
|
RESOLVED_EXIT_ZERO,
|
|
@@ -185,10 +177,10 @@ import {
|
|
|
185
177
|
registerDefaultExecutor,
|
|
186
178
|
registerDefaultExecutors,
|
|
187
179
|
syncCommandEvaluators
|
|
188
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-E7OYNDGL.js";
|
|
189
181
|
import {
|
|
190
182
|
init_platform
|
|
191
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-B7TAL7S5.js";
|
|
192
184
|
|
|
193
185
|
// packages/safe-bash/src/fs/memory/index.ts
|
|
194
186
|
init_platform();
|
|
@@ -2390,6 +2382,7 @@ shell: command substitution: line ${line}: \`${sourceLine}'
|
|
|
2390
2382
|
const unprinted = this.unprintedWords;
|
|
2391
2383
|
const parts = [];
|
|
2392
2384
|
let parentheses = 0;
|
|
2385
|
+
let brackets = 0;
|
|
2393
2386
|
let conditionals = 0;
|
|
2394
2387
|
let patternParentheses = 0;
|
|
2395
2388
|
let regexBracket = false;
|
|
@@ -2455,7 +2448,10 @@ shell: command substitution: line ${line}: \`${sourceLine}'
|
|
|
2455
2448
|
} else if (current === ")" && patternParentheses > 0) patternParentheses--;
|
|
2456
2449
|
else if (/[()<>]/u.test(current) || patternParentheses === 0 && (this.source.startsWith("&&", this.position) || this.source.startsWith("||", this.position))) break;
|
|
2457
2450
|
} else if (terminator) {
|
|
2458
|
-
if (terminator.includes(
|
|
2451
|
+
if (terminator.includes("]") && current === "[") {
|
|
2452
|
+
if (++brackets > this.budget.maxSyntaxDepth) this.error(`Subscript syntax nesting exceeds ${this.budget.maxSyntaxDepth}`);
|
|
2453
|
+
} else if (current === "]" && brackets > 0) brackets--;
|
|
2454
|
+
else if (terminator.includes(current) && (!arithmetic || current !== ":" || parentheses === 0 && conditionals === 0)) break;
|
|
2459
2455
|
} else if (!this.braceReplay) {
|
|
2460
2456
|
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
2457
|
if (++patternParentheses > this.budget.maxSyntaxDepth) this.error(`Syntax nesting exceeds ${this.budget.maxSyntaxDepth}`);
|
|
@@ -7619,7 +7615,7 @@ function tryFastExpandBraceRange(word, budget, reserveBytes) {
|
|
|
7619
7615
|
for (let i = 0; i < text3.length; i++) {
|
|
7620
7616
|
if (i === open || i === close) continue;
|
|
7621
7617
|
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) {
|
|
7618
|
+
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
7619
|
braceRangeWordCache.set(word, null);
|
|
7624
7620
|
return void 0;
|
|
7625
7621
|
}
|
|
@@ -11103,7 +11099,10 @@ var controlNames = /* @__PURE__ */ new Set([
|
|
|
11103
11099
|
"REPLY",
|
|
11104
11100
|
"LANG",
|
|
11105
11101
|
"LC_ALL",
|
|
11106
|
-
"LC_CTYPE"
|
|
11102
|
+
"LC_CTYPE",
|
|
11103
|
+
"RANDOM",
|
|
11104
|
+
"SECONDS",
|
|
11105
|
+
"LINENO"
|
|
11107
11106
|
]);
|
|
11108
11107
|
var OwnedText = class {
|
|
11109
11108
|
constructor(shellValue, bytes, admission) {
|
|
@@ -11727,6 +11726,30 @@ var BindingStore = class _BindingStore {
|
|
|
11727
11726
|
}
|
|
11728
11727
|
};
|
|
11729
11728
|
|
|
11729
|
+
// packages/safe-bash/src/shell/dynamic-variables.ts
|
|
11730
|
+
init_platform();
|
|
11731
|
+
function writeDynamicVariable(state, name2, value) {
|
|
11732
|
+
if (name2 !== "RANDOM" && name2 !== "SECONDS") return;
|
|
11733
|
+
const number2 = Number.parseInt(value, 10) || 0;
|
|
11734
|
+
if (name2 === "RANDOM" && !state.randomDisabled) {
|
|
11735
|
+
state.randomSeed = (number2 >>> 0) % 2147483647 || 1;
|
|
11736
|
+
} else if (name2 === "SECONDS" && !state.secondsDisabled) {
|
|
11737
|
+
state.secondsOrigin = Date.now() - number2 * 1e3;
|
|
11738
|
+
}
|
|
11739
|
+
}
|
|
11740
|
+
function readDynamicVariable(state, name2) {
|
|
11741
|
+
if (name2 === "RANDOM" && !state.randomDisabled) {
|
|
11742
|
+
const seed = (state.randomSeed ?? 1) * 16807 % 2147483647;
|
|
11743
|
+
state.randomSeed = seed;
|
|
11744
|
+
return String((seed ^ seed >>> 16) & 32767);
|
|
11745
|
+
}
|
|
11746
|
+
if (name2 === "SECONDS" && !state.secondsDisabled) {
|
|
11747
|
+
state.secondsOrigin ??= Date.now();
|
|
11748
|
+
return String(Math.floor((Date.now() - state.secondsOrigin) / 1e3));
|
|
11749
|
+
}
|
|
11750
|
+
return void 0;
|
|
11751
|
+
}
|
|
11752
|
+
|
|
11730
11753
|
// packages/safe-bash/src/shell/mapfile.ts
|
|
11731
11754
|
init_platform();
|
|
11732
11755
|
var MapfileUsageError = class extends Error {
|
|
@@ -12302,6 +12325,7 @@ var StateMonitor = class {
|
|
|
12302
12325
|
publishStringVariable(name2, value) {
|
|
12303
12326
|
const tickets = this.mutation(name2);
|
|
12304
12327
|
this.values.publishString(name2, value, this.raw.variables);
|
|
12328
|
+
writeDynamicVariable(this.raw, name2, value);
|
|
12305
12329
|
this.finish(tickets, name2);
|
|
12306
12330
|
}
|
|
12307
12331
|
publish(tickets, name2, action) {
|
|
@@ -12472,6 +12496,7 @@ var StateProxyHandler = class {
|
|
|
12472
12496
|
const name2 = this.named ? String(key) : void 0;
|
|
12473
12497
|
const tickets = this.monitor.mutation(name2);
|
|
12474
12498
|
const result = Reflect.set(target, key, entry);
|
|
12499
|
+
if (result && this.field === "variables" && typeof key === "string" && typeof entry === "string") writeDynamicVariable(this.monitor.raw, key, entry);
|
|
12475
12500
|
if (result) this.monitor.changedValue(target, this.field, key);
|
|
12476
12501
|
this.monitor.finish(tickets, name2);
|
|
12477
12502
|
return result;
|
|
@@ -14062,8 +14087,6 @@ Object.assign(Budget2.prototype, {
|
|
|
14062
14087
|
_hasExternalSignal: false
|
|
14063
14088
|
});
|
|
14064
14089
|
var EMPTY_CAPTURE_BYTES = new Uint8Array(0);
|
|
14065
|
-
var sharedCaptureStdoutScratch = new Uint8Array(65536);
|
|
14066
|
-
var sharedCaptureStderrScratch = new Uint8Array(65536);
|
|
14067
14090
|
var Capture = class {
|
|
14068
14091
|
constructor(budget, signal) {
|
|
14069
14092
|
this._chunks = void 0;
|
|
@@ -14077,8 +14100,8 @@ var Capture = class {
|
|
|
14077
14100
|
this.signal = signal;
|
|
14078
14101
|
this.file = void 0;
|
|
14079
14102
|
}
|
|
14080
|
-
enableScratchBuffer(
|
|
14081
|
-
this._scratch4k ??=
|
|
14103
|
+
enableScratchBuffer() {
|
|
14104
|
+
this._scratch4k ??= new Uint8Array(65536);
|
|
14082
14105
|
}
|
|
14083
14106
|
get self() {
|
|
14084
14107
|
return this;
|
|
@@ -15403,6 +15426,7 @@ function publishVariable(state, name2, value) {
|
|
|
15403
15426
|
return;
|
|
15404
15427
|
}
|
|
15405
15428
|
state.variables[name2] = shellValueText(value);
|
|
15429
|
+
writeDynamicVariable(state, name2, shellValueText(value));
|
|
15406
15430
|
}
|
|
15407
15431
|
function tryRestoreVariableSync(state, name2, saved) {
|
|
15408
15432
|
if (typedSavedVariables.has(saved)) return false;
|
|
@@ -16140,11 +16164,6 @@ function hasGlobOrEscape(text3, extglob = false) {
|
|
|
16140
16164
|
return false;
|
|
16141
16165
|
}
|
|
16142
16166
|
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
16167
|
var fastSubScratchArgs = [];
|
|
16149
16168
|
var defaultValueScopeReserve = ValueScope.prototype.reserve;
|
|
16150
16169
|
var defaultStringCodePointAt = String.prototype.codePointAt;
|
|
@@ -16220,16 +16239,8 @@ var SYNC_UNIT_ZERO = Object.freeze({ exitCode: 0, terminated: false });
|
|
|
16220
16239
|
var SYNC_UNIT_ONE = Object.freeze({ exitCode: 1, terminated: false });
|
|
16221
16240
|
var EMPTY_BYTES = new Uint8Array(0);
|
|
16222
16241
|
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
16242
|
var sharedSyncPipeDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
16226
16243
|
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
16244
|
function isSimpleAsciiGrepPattern(pat) {
|
|
16234
16245
|
const start = pat.length >= 2 && pat.charCodeAt(0) === 94 ? 1 : 0;
|
|
16235
16246
|
if (start >= pat.length) return false;
|
|
@@ -17431,6 +17442,8 @@ var Runtime = class _Runtime {
|
|
|
17431
17442
|
if (dereference) name2 = this.referenceName(state, name2);
|
|
17432
17443
|
if (state.readonlyVariables?.has(name2)) throw new PublicDiagnostic(`${name2}: readonly variable`);
|
|
17433
17444
|
delete state.variables[name2];
|
|
17445
|
+
if (name2 === "RANDOM") state.randomDisabled = true;
|
|
17446
|
+
if (name2 === "SECONDS") state.secondsDisabled = true;
|
|
17434
17447
|
state.exported.delete(name2);
|
|
17435
17448
|
state.variableAttributes?.delete(name2);
|
|
17436
17449
|
if (name2 === "OPTIND" && !internal) this.syncGetopts(state);
|
|
@@ -17630,7 +17643,7 @@ var Runtime = class _Runtime {
|
|
|
17630
17643
|
return true;
|
|
17631
17644
|
case "name": {
|
|
17632
17645
|
const effName = resolveSyncNameref(state, tree.name);
|
|
17633
|
-
if (effName === "OPTIND" || effName === "PIPESTATUS") return false;
|
|
17646
|
+
if (effName === "OPTIND" || effName === "PIPESTATUS" || effName === "RANDOM" || effName === "SECONDS") return false;
|
|
17634
17647
|
const monitor = stateMonitor(state);
|
|
17635
17648
|
if (monitor?.hasOverlay(effName) || monitor?.store?.watches.has(effName)) return false;
|
|
17636
17649
|
if (tree.subscript !== void 0) {
|
|
@@ -17714,6 +17727,7 @@ var Runtime = class _Runtime {
|
|
|
17714
17727
|
return true;
|
|
17715
17728
|
}
|
|
17716
17729
|
tryBuildSyncPatternWord(word, rawState, io, diagnosticLine) {
|
|
17730
|
+
if (word.plain !== void 0) return word.plain.startsWith("~") ? void 0 : word.plain;
|
|
17717
17731
|
if (word.parts.length === 0) return void 0;
|
|
17718
17732
|
let out = "";
|
|
17719
17733
|
for (let i = 0; i < word.parts.length; i++) {
|
|
@@ -17876,7 +17890,7 @@ var Runtime = class _Runtime {
|
|
|
17876
17890
|
this.signal.throwIfAborted();
|
|
17877
17891
|
const name2 = typeof key === "string" ? this.referenceName(state, key) : key;
|
|
17878
17892
|
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);
|
|
17893
|
+
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
17894
|
if (state.nounset && typeof key === "string" && value === void 0) throw new NounsetFailure(`${key}: unbound variable`, line);
|
|
17881
17895
|
return value;
|
|
17882
17896
|
},
|
|
@@ -17913,6 +17927,7 @@ var Runtime = class _Runtime {
|
|
|
17913
17927
|
}
|
|
17914
17928
|
variable(state, name2) {
|
|
17915
17929
|
name2 = this.referenceName(state, name2);
|
|
17930
|
+
if (name2 === "RANDOM" || name2 === "SECONDS") return readDynamicVariable(stateMonitor(state)?.raw ?? state, name2) ?? state.variables[name2];
|
|
17916
17931
|
const binding = arrayStore(state)?.get(name2);
|
|
17917
17932
|
if (binding) return binding.get(binding.associative ? binding.keys.get("30")?.index ?? -1 : 0);
|
|
17918
17933
|
if (name2 === "DIRSTACK") return state.cwd;
|
|
@@ -18672,7 +18687,9 @@ var Runtime = class _Runtime {
|
|
|
18672
18687
|
if (entry.value.parts.length > 0) {
|
|
18673
18688
|
try {
|
|
18674
18689
|
val = this.fastValueWord(entry.value, rawState, io, false, false, false, false, entry.index === void 0 ? void 0 : 0, diagnosticLine);
|
|
18675
|
-
} catch {
|
|
18690
|
+
} catch (error) {
|
|
18691
|
+
this.signal.throwIfAborted();
|
|
18692
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18676
18693
|
return false;
|
|
18677
18694
|
}
|
|
18678
18695
|
}
|
|
@@ -18742,7 +18759,9 @@ var Runtime = class _Runtime {
|
|
|
18742
18759
|
let unsplit;
|
|
18743
18760
|
try {
|
|
18744
18761
|
unsplit = this.fastValueWord(entry.value, rawState, io, false, false, false, false, void 0, diagnosticLine);
|
|
18745
|
-
} catch {
|
|
18762
|
+
} catch (error) {
|
|
18763
|
+
this.signal.throwIfAborted();
|
|
18764
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18746
18765
|
return false;
|
|
18747
18766
|
}
|
|
18748
18767
|
if (typeof unsplit !== "string" || hasGlobOrEscape(unsplit, !!rawState.extglob)) return false;
|
|
@@ -18763,7 +18782,9 @@ var Runtime = class _Runtime {
|
|
|
18763
18782
|
if (entry.value.parts.length > 0) {
|
|
18764
18783
|
try {
|
|
18765
18784
|
val = this.fastValueWord(entry.value, rawState, io, false, false, false, false, entry.index === void 0 ? void 0 : 0, diagnosticLine);
|
|
18766
|
-
} catch {
|
|
18785
|
+
} catch (error) {
|
|
18786
|
+
this.signal.throwIfAborted();
|
|
18787
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18767
18788
|
return false;
|
|
18768
18789
|
}
|
|
18769
18790
|
}
|
|
@@ -18845,7 +18866,9 @@ var Runtime = class _Runtime {
|
|
|
18845
18866
|
let val;
|
|
18846
18867
|
try {
|
|
18847
18868
|
val = this.fastValueWord(assignment.value, rawState, io, false, false, false, false, 0, diagnosticLine);
|
|
18848
|
-
} catch {
|
|
18869
|
+
} catch (error) {
|
|
18870
|
+
this.signal.throwIfAborted();
|
|
18871
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18849
18872
|
return false;
|
|
18850
18873
|
}
|
|
18851
18874
|
if (typeof val !== "string") return false;
|
|
@@ -18873,7 +18896,9 @@ var Runtime = class _Runtime {
|
|
|
18873
18896
|
keyVal = this.fastValueWord(word, rawState, io, false, false, false, false, void 0, diagnosticLine);
|
|
18874
18897
|
if (typeof keyVal !== "string" || keyVal.length === 0) return false;
|
|
18875
18898
|
val = this.fastValueWord(assignment.value, rawState, io, false, false, false, false, 0, diagnosticLine);
|
|
18876
|
-
} catch {
|
|
18899
|
+
} catch (error) {
|
|
18900
|
+
this.signal.throwIfAborted();
|
|
18901
|
+
if (error instanceof ShellLimitError) throw error;
|
|
18877
18902
|
return false;
|
|
18878
18903
|
}
|
|
18879
18904
|
if (typeof val !== "string") return false;
|
|
@@ -18976,11 +19001,10 @@ var Runtime = class _Runtime {
|
|
|
18976
19001
|
const holding = store.owner.hold();
|
|
18977
19002
|
let staged;
|
|
18978
19003
|
try {
|
|
18979
|
-
|
|
18980
|
-
const current = store.get(name2);
|
|
19004
|
+
let current = store.get(name2);
|
|
18981
19005
|
if (associative !== void 0 && current && current.associative !== associative) throw new ArrayFailure("cannot convert array kind");
|
|
18982
19006
|
const isAssociative = associative ?? current?.associative;
|
|
18983
|
-
|
|
19007
|
+
let initialMaximum = current?.maximum ?? (state.variables[name2] === void 0 ? -1 : 0);
|
|
18984
19008
|
let selectedIndex;
|
|
18985
19009
|
let planned = assignment.append && assignment.kind === "compound" ? initialMaximum + 1 : 0;
|
|
18986
19010
|
if (assignment.kind === "element") {
|
|
@@ -19005,6 +19029,31 @@ var Runtime = class _Runtime {
|
|
|
19005
19029
|
}
|
|
19006
19030
|
await operation2.ledger.checkpoint(this.signal, entry.value.parts.length + 2);
|
|
19007
19031
|
}
|
|
19032
|
+
const expandedEntries = [];
|
|
19033
|
+
let elementFields;
|
|
19034
|
+
if (assignment.kind === "element") {
|
|
19035
|
+
elementFields = await this.valueWord(assignment.value, state, io, false, false, false, false, void 0, false, false, 0);
|
|
19036
|
+
} else for (const entry of assignment.entries) {
|
|
19037
|
+
const original = compoundEntryWords.get(entry);
|
|
19038
|
+
let expandedEntry = false;
|
|
19039
|
+
if (entry.index && original && state.braceexpand !== false && original.parts.some((part) => part.kind === "text" && !part.quoted && part.value.includes("{"))) {
|
|
19040
|
+
for await (const expanded of expandBraces(original, this.budget, this.signal)) {
|
|
19041
|
+
if (expanded === original) break;
|
|
19042
|
+
expandedEntry = true;
|
|
19043
|
+
const fields2 = await this.valueWord(expanded, state, io, true, false, false, false, void 0, false, false);
|
|
19044
|
+
operation2.reserve({ metadata: 32, slots: 1, work: 1 });
|
|
19045
|
+
expandedEntries.push({ entry: { value: expanded }, fields: fields2 });
|
|
19046
|
+
}
|
|
19047
|
+
}
|
|
19048
|
+
if (expandedEntry) continue;
|
|
19049
|
+
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);
|
|
19050
|
+
operation2.reserve({ metadata: 32, slots: 1, work: 1 });
|
|
19051
|
+
expandedEntries.push({ entry, fields });
|
|
19052
|
+
}
|
|
19053
|
+
current = store.get(name2);
|
|
19054
|
+
initialMaximum = current?.maximum ?? (state.variables[name2] === void 0 ? -1 : 0);
|
|
19055
|
+
this.assertArrayWritable(state, name2, origin);
|
|
19056
|
+
const watch = await store.watch(name2, operation2, this.signal);
|
|
19008
19057
|
const supersede = await stateMonitor(state).prepareTypedPublication(name2, operation2, this.signal);
|
|
19009
19058
|
await this.prepareArrayObservers(state, operation2);
|
|
19010
19059
|
const tickets = operation2.reserve({ generation: true, version: true, epoch: true, work: 8 });
|
|
@@ -19079,7 +19128,7 @@ var Runtime = class _Runtime {
|
|
|
19079
19128
|
if (stagedKey.pendingKey) pendingKeys.push(stagedKey.pendingKey);
|
|
19080
19129
|
index = stagedKey.index;
|
|
19081
19130
|
} else index = await this.arrayIndex(targetBinding, assignment.index, state, io, operation2, true);
|
|
19082
|
-
const value = await join(
|
|
19131
|
+
const value = await join(elementFields);
|
|
19083
19132
|
if (!current && state.variables[name2] !== void 0 && (index !== 0 || assignment.append)) {
|
|
19084
19133
|
const scalar2 = stateMonitor(state)?.values.get(name2, state.variables[name2]) ?? state.variables[name2];
|
|
19085
19134
|
const token = await valueToken(targetBinding.owner, scalar2, this.signal);
|
|
@@ -19091,23 +19140,8 @@ var Runtime = class _Runtime {
|
|
|
19091
19140
|
}
|
|
19092
19141
|
}
|
|
19093
19142
|
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
|
-
}
|
|
19143
|
+
} else for (const { entry, fields } of expandedEntries) {
|
|
19109
19144
|
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
19145
|
if (index !== void 0) {
|
|
19112
19146
|
const value = await join(fields);
|
|
19113
19147
|
await insert(index, value, entry.append);
|
|
@@ -19970,260 +20004,6 @@ var Runtime = class _Runtime {
|
|
|
19970
20004
|
}
|
|
19971
20005
|
}
|
|
19972
20006
|
}
|
|
19973
|
-
tryRunFastConstEchoBatch(entryCachedUnit, sourceLength, state, io) {
|
|
19974
|
-
if (state.noexec) return void 0;
|
|
19975
|
-
let leadingMkdirUnit;
|
|
19976
|
-
let leadingMkdirPaths;
|
|
19977
|
-
let firstCachedUnit = entryCachedUnit;
|
|
19978
|
-
let firstCc = firstCachedUnit.unit.script._fastConstEcho;
|
|
19979
|
-
if (!firstCc) {
|
|
19980
|
-
const nextU = entryCachedUnit.nextCached;
|
|
19981
|
-
if (!nextU || entryCachedUnit.locale !== false || nextU.locale !== false || entryCachedUnit.unit.script.warnings && entryCachedUnit.unit.script.warnings.length > 0) return void 0;
|
|
19982
|
-
firstCc = nextU.unit.script._fastConstEcho;
|
|
19983
|
-
if (!firstCc) return void 0;
|
|
19984
|
-
const mScript = entryCachedUnit.unit.script;
|
|
19985
|
-
let mPaths = mScript._cachedMkdirPPaths;
|
|
19986
|
-
if (mPaths === void 0) {
|
|
19987
|
-
mPaths = null;
|
|
19988
|
-
if (mScript.lists.length === 1 && !mScript.lists[0].terminator && mScript.lists[0].pipelines.length === 1 && !mScript.lists[0].pipelines[0].negate && mScript.lists[0].pipelines[0].commands.length === 1) {
|
|
19989
|
-
const mCmd = mScript.lists[0].pipelines[0].commands[0];
|
|
19990
|
-
if (mCmd.kind === "simple" && mCmd.redirects.length === 0 && mCmd.words.length >= 3 && mCmd.words[0].plain === "mkdir" && mCmd.words[1].plain === "-p") {
|
|
19991
|
-
const arr = [];
|
|
19992
|
-
let ok = true;
|
|
19993
|
-
for (let wi = 2; wi < mCmd.words.length; wi++) {
|
|
19994
|
-
const wp = mCmd.words[wi].plain;
|
|
19995
|
-
if (!wp || !isCleanAbsolutePath(wp) || wp === "/" || wp === "/dev" || wp.startsWith("/dev/")) {
|
|
19996
|
-
ok = false;
|
|
19997
|
-
break;
|
|
19998
|
-
}
|
|
19999
|
-
arr.push(wp);
|
|
20000
|
-
}
|
|
20001
|
-
if (ok) mPaths = arr;
|
|
20002
|
-
}
|
|
20003
|
-
}
|
|
20004
|
-
mScript._cachedMkdirPPaths = mPaths;
|
|
20005
|
-
}
|
|
20006
|
-
if (!mPaths) return void 0;
|
|
20007
|
-
leadingMkdirUnit = entryCachedUnit;
|
|
20008
|
-
leadingMkdirPaths = mPaths;
|
|
20009
|
-
firstCachedUnit = nextU;
|
|
20010
|
-
}
|
|
20011
|
-
if (this.middleware.length > 0 || io.terminal !== void 0 || io.asyncDefaultInput !== void 0 || io.admittedHandles !== void 0 || this._fileWrites !== void 0 && this._fileWrites.size > 0 || !this._isMemoryBackingFs || !this.backingFs || !this.budget.canRedirect1 || !this.budget.hasInfiniteFsOps || io.descriptors && (io.descriptors.size > 3 || io.descriptors.get(0)?.closed || io.descriptors.get(1)?.closed || io.descriptors.get(2)?.closed)) {
|
|
20012
|
-
return void 0;
|
|
20013
|
-
}
|
|
20014
|
-
const monitor = ensureStateMonitor(state, this.budget, io[invocationScope]);
|
|
20015
|
-
const rawState = monitor.raw;
|
|
20016
|
-
if (!this.tryStartExtensionsSync(state) || hasActiveExtensions(rawState) || rawState.externalInvocation || hasActiveVariableAttributes(rawState) || guestArrays(state) || rawState.noclobber || rawState.readonlyVariables?.has("PIPESTATUS") || hasShellFunction(rawState, "echo") || rawState.extensions?.builtins.has("echo")) {
|
|
20017
|
-
return void 0;
|
|
20018
|
-
}
|
|
20019
|
-
const def = this.commands.get("echo");
|
|
20020
|
-
if (!def || !defaultEchoExecutors.has(def.execute)) return void 0;
|
|
20021
|
-
const store = monitor.store;
|
|
20022
|
-
const existing = store?.get("PIPESTATUS");
|
|
20023
|
-
const psTarget = existing ? "indexed" : pipelineStatusTarget(rawState);
|
|
20024
|
-
if (psTarget !== "indexed" && psTarget !== "absent" || store?.watches.has("PIPESTATUS") || monitor.hasOverlay("PIPESTATUS")) return void 0;
|
|
20025
|
-
if (existing && (existing.associative || existing.values.size !== 1 || existing.maximum !== 0)) return void 0;
|
|
20026
|
-
const elem0 = existing?.values.get(0);
|
|
20027
|
-
if (existing && (!elem0 || elem0.text.bytes !== 1 || existing.references !== 1 || elem0.text.references !== 1)) return void 0;
|
|
20028
|
-
const byteLength0 = firstCc.encoded.byteLength;
|
|
20029
|
-
if (this.budget.bytes + byteLength0 > this.budget.maxOutputBytesSmi && byteLength0 > this.budget.limits.maxOutputBytes - this.budget.bytes || !this.budget.canFileSystemOperation() || this.budget.commands + 1 > this.budget.maxCommandsSmi && this.budget.commands + 1 > this.budget.limits.maxCommands) {
|
|
20030
|
-
return void 0;
|
|
20031
|
-
}
|
|
20032
|
-
const umask = rawState.umask ?? 18;
|
|
20033
|
-
if (leadingMkdirUnit !== void 0 && leadingMkdirPaths !== void 0) {
|
|
20034
|
-
if ((umask & 192) !== 0 || this._outputFiles !== void 0 && this._outputFiles.size > 0 || hasShellFunction(rawState, "mkdir") || rawState.extensions?.builtins.has("mkdir")) return void 0;
|
|
20035
|
-
const mkdirDef = this.commands.get("mkdir");
|
|
20036
|
-
if (!mkdirDef || !defaultMkdirExecutors.has(mkdirDef.execute)) return void 0;
|
|
20037
|
-
const dirMode = 511 & ~umask;
|
|
20038
|
-
try {
|
|
20039
|
-
for (let mi = 0; mi < leadingMkdirPaths.length; mi++) {
|
|
20040
|
-
const mp = leadingMkdirPaths[mi];
|
|
20041
|
-
if (!tryMkdirMemorySync(this.backingFs, mp, true, dirMode, this.commandSignal, firstCc.dirPrefix.startsWith(mp) && firstCc.dirPrefix.length === mp.length + 1 ? firstCc.dirPrefix : void 0)) return void 0;
|
|
20042
|
-
this.budget.fileSystemOperation();
|
|
20043
|
-
}
|
|
20044
|
-
} catch {
|
|
20045
|
-
this.signal.throwIfAborted();
|
|
20046
|
-
return void 0;
|
|
20047
|
-
}
|
|
20048
|
-
this.budget.commands++;
|
|
20049
|
-
this.budget.parsing.admit(firstCachedUnit.unitsCharged);
|
|
20050
|
-
}
|
|
20051
|
-
const mode = 438 & ~umask;
|
|
20052
|
-
try {
|
|
20053
|
-
if (!tryWriteMemoryFileInDirSync(this.backingFs, firstCc.dirPrefix, firstCc.fileName, firstCc.encoded, firstCc.append, mode, this.commandSignal)) return void 0;
|
|
20054
|
-
} catch {
|
|
20055
|
-
this.signal.throwIfAborted();
|
|
20056
|
-
return void 0;
|
|
20057
|
-
}
|
|
20058
|
-
this.budget.tick();
|
|
20059
|
-
this.budget.fileSystemOperation();
|
|
20060
|
-
this.budget.bytes += byteLength0;
|
|
20061
|
-
let lastArg = firstCc.arg0;
|
|
20062
|
-
let cur = firstCachedUnit;
|
|
20063
|
-
const vars = rawState.variables;
|
|
20064
|
-
const curLocale = vars.LC_ALL || vars.LC_CTYPE || vars.LANG ? byteLocale(vars) : false;
|
|
20065
|
-
const mem = this.backingFs;
|
|
20066
|
-
let deadRmTarget;
|
|
20067
|
-
let deadRmTargetLen = 0;
|
|
20068
|
-
const rmDef = this.commands.get("rm");
|
|
20069
|
-
if (mem.symlinkCount === 0 && curLocale === false && rmDef && defaultRmExecutors.has(rmDef.execute) && !hasShellFunction(rawState, "rm") && !rawState.extensions?.builtins.has("rm")) {
|
|
20070
|
-
const cachedCc = firstCc;
|
|
20071
|
-
let target = cachedCc._cachedRmTarget;
|
|
20072
|
-
let scanCount = cachedCc._cachedScanCount ?? 0;
|
|
20073
|
-
if (target === void 0) {
|
|
20074
|
-
let scan = firstCachedUnit;
|
|
20075
|
-
scanCount = 1;
|
|
20076
|
-
while (scan.nextCached !== void 0 && scan.nextCached.locale === false && (!scan.nextCached.unit.script.warnings || scan.nextCached.unit.script.warnings.length === 0) && scan.nextCached.unit.script._fastConstEcho !== void 0) {
|
|
20077
|
-
scan = scan.nextCached;
|
|
20078
|
-
scanCount++;
|
|
20079
|
-
}
|
|
20080
|
-
target = null;
|
|
20081
|
-
const after = scan.nextCached;
|
|
20082
|
-
if (after !== void 0 && after.locale === false && (!after.unit.script.warnings || after.unit.script.warnings.length === 0) && after.unit.script.lists.length === 1) {
|
|
20083
|
-
const list0 = after.unit.script.lists[0];
|
|
20084
|
-
if (!list0.terminator && list0.pipelines.length === 1 && !list0.pipelines[0].negate && list0.pipelines[0].commands.length === 1) {
|
|
20085
|
-
const cmd0 = list0.pipelines[0].commands[0];
|
|
20086
|
-
if (cmd0.kind === "simple" && cmd0.redirects.length === 0 && cmd0.words.length === 3 && cmd0.words[0].plain === "rm" && (cmd0.words[1].plain === "-rf" || cmd0.words[1].plain === "-fr")) {
|
|
20087
|
-
const t = cmd0.words[2].plain;
|
|
20088
|
-
if (t && t.length > 1 && t.charCodeAt(0) === 47 && t.charCodeAt(t.length - 1) !== 47 && !t.includes("/.")) target = t;
|
|
20089
|
-
}
|
|
20090
|
-
}
|
|
20091
|
-
}
|
|
20092
|
-
cachedCc._cachedRmTarget = target;
|
|
20093
|
-
cachedCc._cachedScanCount = scanCount;
|
|
20094
|
-
}
|
|
20095
|
-
if (target !== null && this.budget.commands + scanCount + 1 <= this.budget.maxCommandsSmi && tryGetMemoryDirectoryEntryNamesSync(this.backingFs, target)?.size === 0) {
|
|
20096
|
-
deadRmTarget = target;
|
|
20097
|
-
deadRmTargetLen = target.length;
|
|
20098
|
-
}
|
|
20099
|
-
}
|
|
20100
|
-
const cachedBatchPlan = deadRmTarget !== void 0 ? firstCc._cachedEchoBatch : void 0;
|
|
20101
|
-
if (cachedBatchPlan !== void 0 && cachedBatchPlan !== null && mem.symlinkCount === 0 && !this.signal.aborted && this.budget.bytes + cachedBatchPlan.totalBytes <= this.budget.maxOutputBytesSmi && this.budget._fileSystemOperations + cachedBatchPlan.totalCount <= this.budget.maxFileSystemOperationsSmi && this.budget.commands + cachedBatchPlan.totalCount <= this.budget.maxCommandsSmi) {
|
|
20102
|
-
this.budget.parsing.admit(cachedBatchPlan.totalUnitsCharged);
|
|
20103
|
-
try {
|
|
20104
|
-
mem.writeMemoryFilesInDirBatchFast(firstCc.fileName, firstCc.dirPrefix, cachedBatchPlan.fileNames, cachedBatchPlan.nameHashes, cachedBatchPlan.payloads, cachedBatchPlan.totalNameBytes, cachedBatchPlan.payloadBytesSum, mode);
|
|
20105
|
-
this.budget.commands += cachedBatchPlan.totalCount;
|
|
20106
|
-
this.budget._fileSystemOperations += cachedBatchPlan.totalCount;
|
|
20107
|
-
this.budget.bytes += cachedBatchPlan.totalBytes;
|
|
20108
|
-
lastArg = cachedBatchPlan.lastArg;
|
|
20109
|
-
cur = cachedBatchPlan.endUnit;
|
|
20110
|
-
} catch {
|
|
20111
|
-
this.signal.throwIfAborted();
|
|
20112
|
-
}
|
|
20113
|
-
}
|
|
20114
|
-
if (cur !== cachedBatchPlan?.endUnit && cur.unit.next < sourceLength && mem.symlinkCount === 0 && !this.signal.aborted) {
|
|
20115
|
-
const buildBatchStart = cur === firstCachedUnit && deadRmTarget !== void 0 && cachedBatchPlan === void 0;
|
|
20116
|
-
let bTotalCount = 0;
|
|
20117
|
-
let bTotalBytes = 0;
|
|
20118
|
-
let bTotalUnits = 0;
|
|
20119
|
-
let bTotalNameBytes = 0;
|
|
20120
|
-
let bPayloadBytesSum = 0;
|
|
20121
|
-
let bCanCache = buildBatchStart && !firstCc.append;
|
|
20122
|
-
const bFileNames = bCanCache ? [] : void 0;
|
|
20123
|
-
const bHashes = bCanCache ? [] : void 0;
|
|
20124
|
-
const bPayloads = bCanCache ? [] : void 0;
|
|
20125
|
-
const bSeenNames = bCanCache ? /* @__PURE__ */ new Set([firstCc.fileName]) : void 0;
|
|
20126
|
-
while (cur.unit.next < sourceLength && mem.symlinkCount === 0 && !this.signal.aborted) {
|
|
20127
|
-
const next = cur.nextCached;
|
|
20128
|
-
if (!next || next.locale !== curLocale || next.unit.script.warnings && next.unit.script.warnings.length > 0) break;
|
|
20129
|
-
const nextCc = next.unit.script._fastConstEcho;
|
|
20130
|
-
if (!nextCc) break;
|
|
20131
|
-
const bLen = nextCc.encoded.byteLength;
|
|
20132
|
-
if (this.budget.bytes + bLen > this.budget.maxOutputBytesSmi || this.budget._fileSystemOperations + 1 > this.budget.maxFileSystemOperationsSmi || this.budget.commands + 1 > this.budget.maxCommandsSmi) {
|
|
20133
|
-
break;
|
|
20134
|
-
}
|
|
20135
|
-
this.budget.parsing.admit(next.unitsCharged);
|
|
20136
|
-
if (!(deadRmTarget !== void 0 && nextCc.dirPrefix.length === deadRmTargetLen + 1 && nextCc.dirPrefix.charCodeAt(deadRmTargetLen) === 47 && nextCc.dirPrefix.startsWith(deadRmTarget))) {
|
|
20137
|
-
let nameHash = nextCc._nameHash;
|
|
20138
|
-
if (nameHash === void 0) {
|
|
20139
|
-
const fn = nextCc.fileName;
|
|
20140
|
-
let h = 5381;
|
|
20141
|
-
for (let ci = 0; ci < fn.length; ci++) h = ((h & 2097151) * 33 ^ fn.charCodeAt(ci)) & 1073741823;
|
|
20142
|
-
nextCc._nameHash = nameHash = h;
|
|
20143
|
-
}
|
|
20144
|
-
try {
|
|
20145
|
-
mem.writeMemoryFileInDirFast(nextCc.dirPrefix, nextCc.fileName, nextCc.encoded, nextCc.append, mode, nameHash);
|
|
20146
|
-
} catch {
|
|
20147
|
-
this.signal.throwIfAborted();
|
|
20148
|
-
break;
|
|
20149
|
-
}
|
|
20150
|
-
}
|
|
20151
|
-
if (bCanCache) {
|
|
20152
|
-
const isDeadRm = deadRmTarget !== void 0 && nextCc.dirPrefix.length === deadRmTargetLen + 1 && nextCc.dirPrefix.charCodeAt(deadRmTargetLen) === 47 && nextCc.dirPrefix.startsWith(deadRmTarget);
|
|
20153
|
-
if (isDeadRm) {
|
|
20154
|
-
bTotalCount++;
|
|
20155
|
-
bTotalBytes += bLen;
|
|
20156
|
-
bTotalUnits += next.unitsCharged;
|
|
20157
|
-
} else if (!nextCc.append && nextCc.dirPrefix === firstCc.dirPrefix && nextCc.fileName.length <= 85 && !bSeenNames.has(nextCc.fileName)) {
|
|
20158
|
-
bSeenNames.add(nextCc.fileName);
|
|
20159
|
-
bFileNames.push(nextCc.fileName);
|
|
20160
|
-
bHashes.push(nextCc._nameHash);
|
|
20161
|
-
bPayloads.push(nextCc.encoded);
|
|
20162
|
-
bTotalNameBytes += nextCc.fileName.length * 2;
|
|
20163
|
-
bPayloadBytesSum += bLen;
|
|
20164
|
-
bTotalCount++;
|
|
20165
|
-
bTotalBytes += bLen;
|
|
20166
|
-
bTotalUnits += next.unitsCharged;
|
|
20167
|
-
} else bCanCache = false;
|
|
20168
|
-
}
|
|
20169
|
-
this.budget.commands++;
|
|
20170
|
-
this.budget._fileSystemOperations++;
|
|
20171
|
-
this.budget.bytes += bLen;
|
|
20172
|
-
lastArg = nextCc.arg0;
|
|
20173
|
-
cur = next;
|
|
20174
|
-
}
|
|
20175
|
-
if (buildBatchStart) {
|
|
20176
|
-
firstCc._cachedEchoBatch = bCanCache && bTotalCount > 0 ? {
|
|
20177
|
-
endUnit: cur,
|
|
20178
|
-
totalCount: bTotalCount,
|
|
20179
|
-
totalBytes: bTotalBytes,
|
|
20180
|
-
totalUnitsCharged: bTotalUnits,
|
|
20181
|
-
lastArg,
|
|
20182
|
-
fileNames: bFileNames,
|
|
20183
|
-
nameHashes: new Int32Array(bHashes),
|
|
20184
|
-
payloads: bPayloads,
|
|
20185
|
-
totalNameBytes: bTotalNameBytes,
|
|
20186
|
-
payloadBytesSum: bPayloadBytesSum
|
|
20187
|
-
} : null;
|
|
20188
|
-
}
|
|
20189
|
-
}
|
|
20190
|
-
if (deadRmTarget !== void 0 && cur.nextCached !== void 0 && !this.signal.aborted && mem.symlinkCount === 0 && (this._outputFiles === void 0 || this._outputFiles.size === 0) && !hasShellFunction(rawState, "rm") && !rawState.extensions?.builtins.has("rm")) {
|
|
20191
|
-
const rmDef2 = this.commands.get("rm");
|
|
20192
|
-
const rmUnit = cur.nextCached;
|
|
20193
|
-
const rmCmd0 = rmUnit.unit.script.lists[0]?.pipelines[0]?.commands[0];
|
|
20194
|
-
if (rmDef2 && defaultRmExecutors.has(rmDef2.execute) && rmCmd0 && rmCmd0.kind === "simple" && rmCmd0.words[0]?.plain === "rm" && rmCmd0.words[2]?.plain === deadRmTarget) {
|
|
20195
|
-
let rmOk = false;
|
|
20196
|
-
try {
|
|
20197
|
-
rmOk = tryRmRfMemorySync(this.backingFs, deadRmTarget, this.commandSignal);
|
|
20198
|
-
} catch {
|
|
20199
|
-
this.signal.throwIfAborted();
|
|
20200
|
-
}
|
|
20201
|
-
if (rmOk) {
|
|
20202
|
-
this.budget.parsing.admit(rmUnit.unitsCharged);
|
|
20203
|
-
this.budget.commands++;
|
|
20204
|
-
this.budget._fileSystemOperations++;
|
|
20205
|
-
lastArg = deadRmTarget;
|
|
20206
|
-
cur = rmUnit;
|
|
20207
|
-
}
|
|
20208
|
-
}
|
|
20209
|
-
}
|
|
20210
|
-
const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
|
|
20211
|
-
rawState.substitutionStatus = 0;
|
|
20212
|
-
if (rawState.variables._ !== void 0) delete rawState.variables._;
|
|
20213
|
-
rawState.lastArgument = lastArg;
|
|
20214
|
-
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
20215
|
-
if (!existing) {
|
|
20216
|
-
monitor.lazyPipeStatus = singleStatusZero;
|
|
20217
|
-
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
20218
|
-
} else {
|
|
20219
|
-
elem0.text.shellValue = "0";
|
|
20220
|
-
store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
|
|
20221
|
-
}
|
|
20222
|
-
rawState.status = 0;
|
|
20223
|
-
monitor.epoch = restEpoch;
|
|
20224
|
-
if (store) store.epoch = restEpoch;
|
|
20225
|
-
return cur;
|
|
20226
|
-
}
|
|
20227
20007
|
tryRunCachedSyncForScript(script, monitor, io) {
|
|
20228
20008
|
const rawScript = script;
|
|
20229
20009
|
let plan = rawScript._cachedSyncForScriptPlan;
|
|
@@ -20308,10 +20088,12 @@ var Runtime = class _Runtime {
|
|
|
20308
20088
|
rawScript._cachedSyncForScriptPlan = plan;
|
|
20309
20089
|
}
|
|
20310
20090
|
const forPlan = plan.forCmd._cachedForPlan;
|
|
20091
|
+
if (plan.echoVar !== void 0 && (!forPlan.touchedIntNamesList.includes(plan.echoVar) || forPlan.touchedIntNamesList.includes("IFS") || rawState.variables.IFS !== void 0 && rawState.variables.IFS !== " \n" || plan.initAssigns.some((assignment) => assignment.name === "IFS"))) return void 0;
|
|
20311
20092
|
const fastSyncSink = plan.echoVar !== void 0 ? io.stdout instanceof BudgetedSyncSink && io.stdout.write === BudgetedSyncSink.prototype.write || io.stdout instanceof Capture && io.stdout.write === Capture.prototype.write ? io.stdout : void 0 : void 0;
|
|
20312
20093
|
if (plan.echoVar !== void 0) {
|
|
20313
20094
|
const def = this.commands.get("echo");
|
|
20314
20095
|
if (!fastSyncSink || !def || !defaultEchoExecutors.has(def.execute) || hasShellFunction(rawState, "echo") || rawState.extensions?.builtins.has("echo") || io.descriptors && io.descriptors.get(1)?.output !== io.stdout) return void 0;
|
|
20096
|
+
if (this.budget.maxOutputBytesSmi - this.budget.bytes < 12) return void 0;
|
|
20315
20097
|
}
|
|
20316
20098
|
const store = monitor.store;
|
|
20317
20099
|
const existing = store?.get("PIPESTATUS");
|
|
@@ -20332,28 +20114,32 @@ var Runtime = class _Runtime {
|
|
|
20332
20114
|
const finalValues = /* @__PURE__ */ new Map();
|
|
20333
20115
|
for (const assignment of plan.initAssigns) finalValues.set(assignment.name, assignment.strVal);
|
|
20334
20116
|
const regNames = forPlan.regNames;
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
const parsed = fastSafeInt(finalValues.get(refName) ?? rawState.variables[refName], this.budget.parsing);
|
|
20338
|
-
if (parsed === void 0) return void 0;
|
|
20339
|
-
sharedLoopIntRegs[r] = parsed | 0;
|
|
20340
|
-
}
|
|
20341
|
-
const { ok } = runIntForLoop(forPlan.fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
20342
|
-
if (!ok) return void 0;
|
|
20343
|
-
for (let r = 0; r < regNames.length; r++) finalValues.set(regNames[r], intToStr(sharedLoopIntRegs[r]));
|
|
20117
|
+
const savedParseBudget = this.budget.parsing.snapshot();
|
|
20118
|
+
let admitted = false;
|
|
20344
20119
|
let lastArg = "";
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
const
|
|
20353
|
-
if (
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20120
|
+
try {
|
|
20121
|
+
for (let r = 1; r < regNames.length; r++) {
|
|
20122
|
+
const refName = regNames[r];
|
|
20123
|
+
const parsed = fastSafeInt(finalValues.get(refName) ?? rawState.variables[refName], this.budget.parsing);
|
|
20124
|
+
if (parsed === void 0) return void 0;
|
|
20125
|
+
sharedLoopIntRegs[r] = parsed | 0;
|
|
20126
|
+
}
|
|
20127
|
+
const { ok } = runIntForLoop(forPlan.fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
20128
|
+
if (!ok) return void 0;
|
|
20129
|
+
for (const name2 of forPlan.touchedIntNamesList) finalValues.set(name2, intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]));
|
|
20130
|
+
if (plan.echoVar !== void 0) {
|
|
20131
|
+
const echoVal = finalValues.get(plan.echoVar);
|
|
20132
|
+
const encoded = encodeRedirectTextWithNewlineToScratch(echoVal);
|
|
20133
|
+
if (!encoded) return void 0;
|
|
20134
|
+
const bLen = encoded.byteLength;
|
|
20135
|
+
if (this.budget.bytes + bLen > this.budget.maxOutputBytesSmi) return void 0;
|
|
20136
|
+
if (!fastSyncSink.writeSync(encoded)) return void 0;
|
|
20137
|
+
this.budget.bytes += bLen;
|
|
20138
|
+
lastArg = echoVal;
|
|
20139
|
+
}
|
|
20140
|
+
admitted = true;
|
|
20141
|
+
} finally {
|
|
20142
|
+
if (!admitted) this.budget.parsing.restore(savedParseBudget);
|
|
20357
20143
|
}
|
|
20358
20144
|
for (const [name2, value] of finalValues) rawState.variables[name2] = value;
|
|
20359
20145
|
for (const name2 of publishNames) {
|
|
@@ -20509,7 +20295,7 @@ var Runtime = class _Runtime {
|
|
|
20509
20295
|
const diagnosticLine = io.diagnosticCommandLines?.get(command) ?? (command.line ?? 1) + (io.diagnosticOffset ?? 0);
|
|
20510
20296
|
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
20297
|
w0Plain = cSingle.w0Plain;
|
|
20512
|
-
const extD = this.
|
|
20298
|
+
const extD = this.commands.get(w0Plain);
|
|
20513
20299
|
if (!extD || !builtInDirectContextExecutors.has(extD.execute) || customRegisteredCommands.has(extD.execute)) return void 0;
|
|
20514
20300
|
externalDef = extD;
|
|
20515
20301
|
args = cSingle.args;
|
|
@@ -20527,7 +20313,7 @@ var Runtime = class _Runtime {
|
|
|
20527
20313
|
return void 0;
|
|
20528
20314
|
}
|
|
20529
20315
|
w0Plain = w0P;
|
|
20530
|
-
const extD = this.
|
|
20316
|
+
const extD = this.commands.get(w0Plain);
|
|
20531
20317
|
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
20318
|
return void 0;
|
|
20533
20319
|
}
|
|
@@ -20576,13 +20362,11 @@ var Runtime = class _Runtime {
|
|
|
20576
20362
|
let redirectSink;
|
|
20577
20363
|
if (command.redirects.length === 1) {
|
|
20578
20364
|
const r0 = command.redirects[0];
|
|
20579
|
-
let targetVal
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
return void 0;
|
|
20585
|
-
}
|
|
20365
|
+
let targetVal;
|
|
20366
|
+
try {
|
|
20367
|
+
targetVal = this.fastValueWord(r0.target, rawState, io, true, false, false, true, void 0, diagnosticLine);
|
|
20368
|
+
} catch {
|
|
20369
|
+
return void 0;
|
|
20586
20370
|
}
|
|
20587
20371
|
if (typeof targetVal !== "string" || !targetVal || targetVal.includes("\0")) return void 0;
|
|
20588
20372
|
let cachedFile = r0._cachedRedirectFile;
|
|
@@ -20639,25 +20423,6 @@ var Runtime = class _Runtime {
|
|
|
20639
20423
|
if (pipeline.commands.length >= 2 && !existing) {
|
|
20640
20424
|
const n = pipeline.commands.length;
|
|
20641
20425
|
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
20426
|
for (let i = 0; i < n; i++) {
|
|
20662
20427
|
const cmd = pipeline.commands[i];
|
|
20663
20428
|
if (cmd.kind !== "simple" || !this.isPureExternalStageCommand(cmd, rawState) || cmd.words.length > this.budget.maxExpansionFieldsSmi) return void 0;
|
|
@@ -20766,11 +20531,10 @@ var Runtime = class _Runtime {
|
|
|
20766
20531
|
return void 0;
|
|
20767
20532
|
}
|
|
20768
20533
|
const n = pipeline.commands.length;
|
|
20769
|
-
let firstStageRootSourceRef;
|
|
20770
20534
|
for (let i = 0; i < n; i++) {
|
|
20771
20535
|
const cmd = pipeline.commands[i];
|
|
20772
20536
|
const name2 = cmd.words[0].plain;
|
|
20773
|
-
const extDef = this.
|
|
20537
|
+
const extDef = this.commands.get(name2);
|
|
20774
20538
|
if (!extDef || !builtInDirectContextExecutors.has(extDef.execute) || customRegisteredCommands.has(extDef.execute)) {
|
|
20775
20539
|
return void 0;
|
|
20776
20540
|
}
|
|
@@ -20794,7 +20558,6 @@ var Runtime = class _Runtime {
|
|
|
20794
20558
|
const slice1 = cmd._cachedSlice1 ?? (cmd._cachedSlice1 = fileArg.slice(1));
|
|
20795
20559
|
const rootEntry = backing.root?.entries?.get(slice1);
|
|
20796
20560
|
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
20561
|
}
|
|
20799
20562
|
} else if (name2 === "find") {
|
|
20800
20563
|
if (stageArgs.length !== 3 || stageArgs[1] !== "-name" || stageArgs[0].startsWith("-") || stageArgs[0].startsWith("/dev")) return void 0;
|
|
@@ -20820,22 +20583,8 @@ var Runtime = class _Runtime {
|
|
|
20820
20583
|
} else return void 0;
|
|
20821
20584
|
}
|
|
20822
20585
|
}
|
|
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
|
-
}
|
|
20586
|
+
const sharedSyncPipeBuf0 = new Uint8Array(65536);
|
|
20587
|
+
const sharedSyncPipeBuf1 = new Uint8Array(65536);
|
|
20839
20588
|
syncPurePipelineSlotInUse = true;
|
|
20840
20589
|
this.budget.enterPipelineStages(n);
|
|
20841
20590
|
this.budget.commands += n;
|
|
@@ -20846,7 +20595,7 @@ var Runtime = class _Runtime {
|
|
|
20846
20595
|
for (let index = start; index < n; index++) {
|
|
20847
20596
|
const cmd = pipeline.commands[index];
|
|
20848
20597
|
const firstName = cmd.words[0].plain;
|
|
20849
|
-
const extDef = this.
|
|
20598
|
+
const extDef = this.commands.get(firstName);
|
|
20850
20599
|
const stageArgs = cmd._cachedPlainArgs;
|
|
20851
20600
|
const isFirst = index === 0;
|
|
20852
20601
|
const isLast = index === n - 1;
|
|
@@ -20911,21 +20660,7 @@ var Runtime = class _Runtime {
|
|
|
20911
20660
|
syncPurePipelineSlotInUse = false;
|
|
20912
20661
|
this.budget.leavePipelineStages(n);
|
|
20913
20662
|
};
|
|
20914
|
-
const stdout = io.stdout;
|
|
20915
|
-
const stderr = io.stderr;
|
|
20916
20663
|
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
20664
|
const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
|
|
20930
20665
|
const finalStatuses = statuses ?? ZERO_PIPE_STATUSES[n] ?? new Array(n).fill(0);
|
|
20931
20666
|
monitor.lazyPipeStatus = finalStatuses;
|
|
@@ -20981,7 +20716,7 @@ var Runtime = class _Runtime {
|
|
|
20981
20716
|
for (let index = 0; index < n; index++) {
|
|
20982
20717
|
const cmd = pipeline.commands[index];
|
|
20983
20718
|
const firstName = cmd.words[0].plain;
|
|
20984
|
-
const extDef = this.
|
|
20719
|
+
const extDef = this.commands.get(firstName);
|
|
20985
20720
|
let stageArgs = cmd._cachedPlainArgs;
|
|
20986
20721
|
if (!stageArgs) {
|
|
20987
20722
|
stageArgs = new Array(cmd.words.length - 1);
|
|
@@ -21966,7 +21701,7 @@ var Runtime = class _Runtime {
|
|
|
21966
21701
|
}
|
|
21967
21702
|
canSyncConditional(expr, depth = 0, rawState, requireTotal = false) {
|
|
21968
21703
|
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;
|
|
21704
|
+
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
21705
|
const okWord = (w) => !_Runtime.wordMayMutate(w) || rawState !== void 0 && this.isPureSyncValueWord(w, rawState);
|
|
21971
21706
|
if (expr.kind === "nonempty") return okWord(expr.operand);
|
|
21972
21707
|
if (expr.kind === "unary") return (expr.operator === "-n" || expr.operator === "-z" || expr.operator === "-v" || syncConditionalFileUnaryOps.has(expr.operator)) && okWord(expr.operand);
|
|
@@ -22440,7 +22175,7 @@ var Runtime = class _Runtime {
|
|
|
22440
22175
|
const rhsOp = scalarMutMatch[4];
|
|
22441
22176
|
const rhs2 = scalarMutMatch[5] !== void 0 ? Number(scalarMutMatch[5]) : 0;
|
|
22442
22177
|
const rhsNum = rhsOp === "+" ? rhs1 + rhs2 : rhsOp === "-" ? rhs1 - rhs2 : rhsOp === "*" ? rhs1 * rhs2 : rhs1;
|
|
22443
|
-
if (varName
|
|
22178
|
+
if (!controlNames.has(varName) && varName !== "PIPESTATUS" && !store?.get(varName) && !hasNonNamerefAttributes(rawState)) {
|
|
22444
22179
|
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
22180
|
if (typeof curVal === "string" && (curVal === "" || /^-?(?:0|[1-9][0-9]{0,12})$/.test(curVal))) {
|
|
22446
22181
|
const curNum = curVal === "" ? 0 : Number(curVal);
|
|
@@ -22658,7 +22393,7 @@ var Runtime = class _Runtime {
|
|
|
22658
22393
|
const clause = command.clauses[cIdx];
|
|
22659
22394
|
for (let pIdx = 0; pIdx < clause.patterns.length; pIdx++) {
|
|
22660
22395
|
const pw = clause.patterns[pIdx];
|
|
22661
|
-
const pStr =
|
|
22396
|
+
const pStr = this.tryBuildSyncPatternWord(pw, rawState, io, diagnosticLine);
|
|
22662
22397
|
if (pStr === void 0) return void 0;
|
|
22663
22398
|
const matched = tryMatchesPatternSync(pStr, fastSubject, work, false, false);
|
|
22664
22399
|
if (matched === void 0) return void 0;
|
|
@@ -24078,7 +23813,7 @@ var Runtime = class _Runtime {
|
|
|
24078
23813
|
}
|
|
24079
23814
|
allArrOk = false;
|
|
24080
23815
|
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
|
|
23816
|
+
} 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
23817
|
ops.push({ kind: "scalar", targetName: tExpanded });
|
|
24083
23818
|
continue;
|
|
24084
23819
|
} else {
|
|
@@ -24142,7 +23877,7 @@ var Runtime = class _Runtime {
|
|
|
24142
23877
|
for (let ui = uStart; ui < command.words.length; ui++) {
|
|
24143
23878
|
const targetName = command.words[ui].plain;
|
|
24144
23879
|
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
|
|
23880
|
+
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
23881
|
targets.push(targetName);
|
|
24147
23882
|
} else {
|
|
24148
23883
|
allOk = false;
|
|
@@ -25420,7 +25155,7 @@ var Runtime = class _Runtime {
|
|
|
25420
25155
|
continue;
|
|
25421
25156
|
}
|
|
25422
25157
|
if (part.kind === "variable") {
|
|
25423
|
-
if (stateMonitor(rawState)?.store?.get(part.name)) return false;
|
|
25158
|
+
if (part.name === "RANDOM" || part.name === "SECONDS" || stateMonitor(rawState)?.store?.get(part.name)) return false;
|
|
25424
25159
|
if (this._syncLoopFnCheckDepth > 0 && (part.substring || getArraySelector(part)?.kind === "element")) return false;
|
|
25425
25160
|
if (part.prefixNames !== void 0) {
|
|
25426
25161
|
if (part.prefixNames === "@") return false;
|
|
@@ -25489,78 +25224,7 @@ var Runtime = class _Runtime {
|
|
|
25489
25224
|
if (part.kind === "substitution") {
|
|
25490
25225
|
if (this._syncLoopFnCheckDepth > 0) return false;
|
|
25491
25226
|
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;
|
|
25227
|
+
return false;
|
|
25564
25228
|
}
|
|
25565
25229
|
return false;
|
|
25566
25230
|
}
|
|
@@ -25612,7 +25276,7 @@ var Runtime = class _Runtime {
|
|
|
25612
25276
|
};
|
|
25613
25277
|
return preservesInteger(script);
|
|
25614
25278
|
};
|
|
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)));
|
|
25279
|
+
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
25280
|
if (args.length === 2) {
|
|
25617
25281
|
const op = args[0].plain;
|
|
25618
25282
|
if ((op === "-n" || op === "-z") && safeArgWord(args[1])) {
|
|
@@ -25987,7 +25651,7 @@ var Runtime = class _Runtime {
|
|
|
25987
25651
|
const work = { remaining: 4096, signal: this.signal, exhausted: () => this.budget.fail("maxExpansionBytes") };
|
|
25988
25652
|
for (const cl of cmd.clauses) {
|
|
25989
25653
|
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;
|
|
25654
|
+
if (!cl.patterns.every((pw) => pw.plain !== void 0 && !pw.plain.startsWith("~") && tryMatchesPatternSync(pw.plain, "", work, false, false) !== void 0)) return false;
|
|
25991
25655
|
if (!isSimpleEchoOrPrintf(cl.body)) return false;
|
|
25992
25656
|
}
|
|
25993
25657
|
return true;
|
|
@@ -26072,7 +25736,7 @@ var Runtime = class _Runtime {
|
|
|
26072
25736
|
if (!cl.patterns.every((pw) => {
|
|
26073
25737
|
if (!pw.parts.every((p2) => p2.kind === "text")) return false;
|
|
26074
25738
|
if (pw.plain === void 0 && !pw.parts.every((p2) => p2.quoted)) return false;
|
|
26075
|
-
const pattern =
|
|
25739
|
+
const pattern = io ? this.tryBuildSyncPatternWord(pw, rawState, io) : pw.plain?.startsWith("~") ? void 0 : pw.plain;
|
|
26076
25740
|
return pattern !== void 0 && tryMatchesPatternSync(pattern, "", work, false, false) !== void 0;
|
|
26077
25741
|
})) {
|
|
26078
25742
|
caseOk = false;
|
|
@@ -26604,7 +26268,7 @@ var Runtime = class _Runtime {
|
|
|
26604
26268
|
for (let b = 0; b + 1 < bodyAssignments.length; b++) {
|
|
26605
26269
|
const curr = bodyAssignments[b];
|
|
26606
26270
|
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)) {
|
|
26271
|
+
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
26272
|
curr.coalesceNext = true;
|
|
26609
26273
|
b++;
|
|
26610
26274
|
}
|
|
@@ -26668,23 +26332,32 @@ var Runtime = class _Runtime {
|
|
|
26668
26332
|
return void 0;
|
|
26669
26333
|
}
|
|
26670
26334
|
const regNames = forPlan.regNames;
|
|
26335
|
+
for (const refName of regNames) {
|
|
26336
|
+
if (store?.get(refName) || store?.watches.has(refName) || monitor.hasOverlay(refName) || rawState.variableAttributes?.has(refName)) return void 0;
|
|
26337
|
+
}
|
|
26338
|
+
const intBudgetSnapshot = this.budget.parsing.snapshot();
|
|
26671
26339
|
for (let r = 0; r < regNames.length; r++) {
|
|
26672
26340
|
const refName = regNames[r];
|
|
26673
|
-
if (store?.get(refName)) return void 0;
|
|
26674
26341
|
if (r > 0) {
|
|
26675
26342
|
const parsed = fastSafeInt(rawState.variables[refName], this.budget.parsing);
|
|
26676
|
-
if (parsed === void 0)
|
|
26343
|
+
if (parsed === void 0) {
|
|
26344
|
+
this.budget.parsing.restore(intBudgetSnapshot);
|
|
26345
|
+
return void 0;
|
|
26346
|
+
}
|
|
26677
26347
|
sharedLoopIntRegs[r] = parsed | 0;
|
|
26678
26348
|
}
|
|
26679
26349
|
}
|
|
26350
|
+
const { ok } = runIntForLoop(fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
26351
|
+
if (!ok) {
|
|
26352
|
+
this.budget.parsing.restore(intBudgetSnapshot);
|
|
26353
|
+
return void 0;
|
|
26354
|
+
}
|
|
26680
26355
|
monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets);
|
|
26681
26356
|
this.budget.tick();
|
|
26682
|
-
const { ok } = runIntForLoop(fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
|
|
26683
|
-
if (!ok) return void 0;
|
|
26684
26357
|
this.budget.iterations += wordCount;
|
|
26685
26358
|
this.budget.commands += wordCount * forPlan.bodyStepCount;
|
|
26686
|
-
for (
|
|
26687
|
-
rawState.variables[
|
|
26359
|
+
for (const name2 of forPlan.touchedIntNamesList) {
|
|
26360
|
+
rawState.variables[name2] = intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]);
|
|
26688
26361
|
}
|
|
26689
26362
|
const touchedList = forPlan.touchedIntNamesList;
|
|
26690
26363
|
for (let t = 0; t < touchedList.length; t++) {
|
|
@@ -26811,6 +26484,7 @@ var Runtime = class _Runtime {
|
|
|
26811
26484
|
touched.clear();
|
|
26812
26485
|
let lastCmd;
|
|
26813
26486
|
let lastArg = "";
|
|
26487
|
+
let lastPipelineStatus;
|
|
26814
26488
|
const mode = 438 & ~(rawState.umask ?? 18);
|
|
26815
26489
|
if (command.kind === "arithmetic-for") {
|
|
26816
26490
|
let plan = command._cachedArithPlan;
|
|
@@ -27116,6 +26790,7 @@ var Runtime = class _Runtime {
|
|
|
27116
26790
|
if (!ok) canUseIntRegisters = false;
|
|
27117
26791
|
else {
|
|
27118
26792
|
usedFastIntPath = true;
|
|
26793
|
+
if (iterations > 0) lastPipelineStatus = 0;
|
|
27119
26794
|
this.budget.parsing.admit(limitVal < 0 ? 4 : 2);
|
|
27120
26795
|
this.budget.iterations += iterations + 1;
|
|
27121
26796
|
this.budget.commands += iterations * bodyAssignments.length + subCount;
|
|
@@ -27143,6 +26818,7 @@ var Runtime = class _Runtime {
|
|
|
27143
26818
|
loopStatus2 = rawState.status;
|
|
27144
26819
|
lastCmd = fb.lastCmd;
|
|
27145
26820
|
lastArg = fb.lastArg;
|
|
26821
|
+
lastPipelineStatus = fb.pipelineStatus;
|
|
27146
26822
|
lastInductionVal = fb.lastInductionVal;
|
|
27147
26823
|
} finally {
|
|
27148
26824
|
this._syncReturnDepth--;
|
|
@@ -27207,11 +26883,13 @@ var Runtime = class _Runtime {
|
|
|
27207
26883
|
if (rawState.variables._ !== void 0 && !touched.has("_") && !(usedFastIntPath && touchedIntNamesList.includes("_"))) delete rawState.variables._;
|
|
27208
26884
|
rawState.lastArgument = lastArg;
|
|
27209
26885
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
26886
|
+
}
|
|
26887
|
+
if (lastPipelineStatus !== void 0) {
|
|
27210
26888
|
if (!existing) {
|
|
27211
|
-
monitor.lazyPipeStatus =
|
|
26889
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27212
26890
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27213
26891
|
} else {
|
|
27214
|
-
this.setSyncPipeStatusCell(existing, String(
|
|
26892
|
+
this.setSyncPipeStatusCell(existing, String(lastPipelineStatus));
|
|
27215
26893
|
store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
|
|
27216
26894
|
}
|
|
27217
26895
|
}
|
|
@@ -27226,6 +26904,7 @@ var Runtime = class _Runtime {
|
|
|
27226
26904
|
const cp = command.condition.lists[0].pipelines[0];
|
|
27227
26905
|
if (cp.negate || cp.commands.length !== 1) return void 0;
|
|
27228
26906
|
const condCmd = cp.commands[0];
|
|
26907
|
+
if (condCmd.kind !== "simple" && condCmd.kind !== "arithmetic" && condCmd.kind !== "conditional") return void 0;
|
|
27229
26908
|
let whileArithProg;
|
|
27230
26909
|
let whileCondExpr;
|
|
27231
26910
|
let whileReadSpec;
|
|
@@ -27375,6 +27054,7 @@ var Runtime = class _Runtime {
|
|
|
27375
27054
|
this._syncArithTouched = touched;
|
|
27376
27055
|
const condLine = io.diagnosticCommandLines?.get(condCmd) ?? (condCmd.line ?? diagnosticLine) + (io.diagnosticOffset ?? 0);
|
|
27377
27056
|
let loopStatus2 = 0;
|
|
27057
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
27378
27058
|
let iterCount = 0;
|
|
27379
27059
|
try {
|
|
27380
27060
|
if (whileReadSpec !== void 0 && syncReadInputText !== void 0) {
|
|
@@ -27430,8 +27110,9 @@ var Runtime = class _Runtime {
|
|
|
27430
27110
|
rawState.variables[vn] = "";
|
|
27431
27111
|
touched.add(vn);
|
|
27432
27112
|
}
|
|
27433
|
-
lastCmd = rCmd;
|
|
27434
|
-
lastArg = rLastArg;
|
|
27113
|
+
progress.lastCmd = rCmd;
|
|
27114
|
+
progress.lastArg = rLastArg;
|
|
27115
|
+
progress.pipelineStatus = 1;
|
|
27435
27116
|
break;
|
|
27436
27117
|
}
|
|
27437
27118
|
const nlIdx = syncReadInputText.indexOf(readDelim, cursor);
|
|
@@ -27439,21 +27120,22 @@ var Runtime = class _Runtime {
|
|
|
27439
27120
|
const partialLine = syncReadInputText.slice(cursor);
|
|
27440
27121
|
cursor = textLen;
|
|
27441
27122
|
splitSyncReadLine(partialLine, readIfs);
|
|
27442
|
-
lastCmd = rCmd;
|
|
27443
|
-
lastArg = rLastArg;
|
|
27123
|
+
progress.lastCmd = rCmd;
|
|
27124
|
+
progress.lastArg = rLastArg;
|
|
27125
|
+
progress.pipelineStatus = 1;
|
|
27444
27126
|
break;
|
|
27445
27127
|
}
|
|
27446
27128
|
const lineStr = syncReadInputText.slice(cursor, nlIdx);
|
|
27447
27129
|
cursor = nlIdx + 1;
|
|
27448
27130
|
splitSyncReadLine(lineStr, readIfs);
|
|
27131
|
+
progress.lastCmd = rCmd;
|
|
27132
|
+
progress.lastArg = rLastArg;
|
|
27133
|
+
progress.pipelineStatus = 0;
|
|
27449
27134
|
rawState.status = 0;
|
|
27450
27135
|
++iterCount;
|
|
27451
27136
|
this.budget.loop();
|
|
27452
27137
|
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
|
-
});
|
|
27138
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27457
27139
|
loopStatus2 = rawState.status;
|
|
27458
27140
|
if (this._syncLoopAction !== void 0) {
|
|
27459
27141
|
const act = this._syncLoopAction;
|
|
@@ -27480,17 +27162,15 @@ var Runtime = class _Runtime {
|
|
|
27480
27162
|
}
|
|
27481
27163
|
rawState.variables[whileGetoptsSpec.optVar] = res.option;
|
|
27482
27164
|
touched.add(whileGetoptsSpec.optVar);
|
|
27483
|
-
lastCmd = whileGetoptsSpec.getoptsCmd;
|
|
27484
|
-
lastArg = whileGetoptsSpec.cmdLastArg;
|
|
27165
|
+
progress.lastCmd = whileGetoptsSpec.getoptsCmd;
|
|
27166
|
+
progress.lastArg = whileGetoptsSpec.cmdLastArg;
|
|
27167
|
+
progress.pipelineStatus = res.status;
|
|
27485
27168
|
if (res.status !== 0) break;
|
|
27486
27169
|
rawState.status = 0;
|
|
27487
27170
|
++iterCount;
|
|
27488
27171
|
this.budget.loop();
|
|
27489
27172
|
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
|
-
});
|
|
27173
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27494
27174
|
loopStatus2 = rawState.status;
|
|
27495
27175
|
if (this._syncLoopAction !== void 0) {
|
|
27496
27176
|
const act = this._syncLoopAction;
|
|
@@ -27502,19 +27182,15 @@ var Runtime = class _Runtime {
|
|
|
27502
27182
|
while (true) {
|
|
27503
27183
|
this.budget.tick();
|
|
27504
27184
|
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
|
-
}
|
|
27185
|
+
progress.lastCmd = condCmd;
|
|
27186
|
+
if (condCmd.kind === "simple") progress.lastArg = this.fastValueWord(condCmd.words[condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
27509
27187
|
rawState.status = condNonZero ? 0 : 1;
|
|
27188
|
+
progress.pipelineStatus = rawState.status;
|
|
27510
27189
|
if (condNonZero !== (command.kind === "while")) break;
|
|
27511
27190
|
++iterCount;
|
|
27512
27191
|
this.budget.loop();
|
|
27513
27192
|
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
|
-
});
|
|
27193
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
27518
27194
|
loopStatus2 = rawState.status;
|
|
27519
27195
|
if (this._syncLoopAction !== void 0) {
|
|
27520
27196
|
const act = this._syncLoopAction;
|
|
@@ -27540,15 +27216,20 @@ var Runtime = class _Runtime {
|
|
|
27540
27216
|
}
|
|
27541
27217
|
}
|
|
27542
27218
|
}
|
|
27219
|
+
lastCmd = progress.lastCmd;
|
|
27220
|
+
lastArg = progress.lastArg;
|
|
27221
|
+
lastPipelineStatus = progress.pipelineStatus;
|
|
27543
27222
|
if (lastCmd) {
|
|
27544
27223
|
if (rawState.extensions && !rawState.extensions.eventDepth) publishCommandSpelling(rawState, commandSpelling(lastCmd));
|
|
27545
27224
|
rawState.substitutionStatus = 0;
|
|
27546
27225
|
if (rawState.variables._ !== void 0 && !touched.has("_")) delete rawState.variables._;
|
|
27547
27226
|
rawState.lastArgument = lastArg;
|
|
27548
27227
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
27549
|
-
|
|
27228
|
+
}
|
|
27229
|
+
if (lastPipelineStatus !== void 0) {
|
|
27230
|
+
const statusStr = String(lastPipelineStatus);
|
|
27550
27231
|
if (!existing) {
|
|
27551
|
-
monitor.lazyPipeStatus =
|
|
27232
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27552
27233
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27553
27234
|
} else {
|
|
27554
27235
|
this.setSyncPipeStatusCell(existing, statusStr);
|
|
@@ -27824,6 +27505,7 @@ var Runtime = class _Runtime {
|
|
|
27824
27505
|
if (!ok) canUseIntRegisters = false;
|
|
27825
27506
|
else {
|
|
27826
27507
|
usedFastIntFor = true;
|
|
27508
|
+
if (fastLoopWords.length > 0) lastPipelineStatus = 0;
|
|
27827
27509
|
lastCmd = bodyAssignments[bodyAssignments.length - 1]?.cmd;
|
|
27828
27510
|
this.budget.iterations += fastLoopWords.length;
|
|
27829
27511
|
this.budget.commands += fastLoopWords.length * bodyAssignments.length + subCount;
|
|
@@ -27835,8 +27517,8 @@ var Runtime = class _Runtime {
|
|
|
27835
27517
|
rawState.status = 0;
|
|
27836
27518
|
}
|
|
27837
27519
|
runYieldCheckpoint(this.signal);
|
|
27838
|
-
for (
|
|
27839
|
-
rawState.variables[
|
|
27520
|
+
for (const name2 of forPlan.touchedIntNamesList) {
|
|
27521
|
+
rawState.variables[name2] = intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]);
|
|
27840
27522
|
}
|
|
27841
27523
|
regNames.length = 0;
|
|
27842
27524
|
}
|
|
@@ -27851,6 +27533,7 @@ var Runtime = class _Runtime {
|
|
|
27851
27533
|
loopStatus = fastLoopWords.length === 0 ? 0 : rawState.status;
|
|
27852
27534
|
lastCmd = fb.lastCmd;
|
|
27853
27535
|
lastArg = fb.lastArg;
|
|
27536
|
+
lastPipelineStatus = fb.pipelineStatus;
|
|
27854
27537
|
} finally {
|
|
27855
27538
|
this._syncReturnDepth--;
|
|
27856
27539
|
}
|
|
@@ -27889,11 +27572,13 @@ var Runtime = class _Runtime {
|
|
|
27889
27572
|
if (rawState.variables._ !== void 0 && !touched.has("_") && !(usedFastIntFor && forPlan.touchedIntNamesList.includes("_"))) delete rawState.variables._;
|
|
27890
27573
|
rawState.lastArgument = lastArg;
|
|
27891
27574
|
if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
|
|
27575
|
+
}
|
|
27576
|
+
if (lastPipelineStatus !== void 0) {
|
|
27892
27577
|
if (!existing) {
|
|
27893
|
-
monitor.lazyPipeStatus =
|
|
27578
|
+
monitor.lazyPipeStatus = lastPipelineStatus === 0 ? singleStatusZero : [lastPipelineStatus];
|
|
27894
27579
|
monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
|
|
27895
27580
|
} else {
|
|
27896
|
-
this.setSyncPipeStatusCell(existing, String(
|
|
27581
|
+
this.setSyncPipeStatusCell(existing, String(lastPipelineStatus));
|
|
27897
27582
|
store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
|
|
27898
27583
|
}
|
|
27899
27584
|
}
|
|
@@ -28404,8 +28089,7 @@ ${s1}
|
|
|
28404
28089
|
}
|
|
28405
28090
|
runSyncArithForFallback(e0, e1, e2, inductionName, hasDeferredSteps, deferredMask, bodyAssignments, rawState, io, monitor, touched, mode, diagnosticLine) {
|
|
28406
28091
|
let enteredBody = false;
|
|
28407
|
-
|
|
28408
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28092
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
28409
28093
|
let lastInductionVal;
|
|
28410
28094
|
touched.add(inductionName);
|
|
28411
28095
|
this.syncShellArithmeticNonZero(e0, rawState, diagnosticLine);
|
|
@@ -28416,150 +28100,7 @@ ${s1}
|
|
|
28416
28100
|
if (!this.syncShellArithmeticNonZero(e1, rawState, diagnosticLine)) break;
|
|
28417
28101
|
enteredBody = true;
|
|
28418
28102
|
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
|
-
}
|
|
28103
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress, deferredMask);
|
|
28563
28104
|
if (this._syncLoopAction !== void 0) {
|
|
28564
28105
|
const act = this._syncLoopAction;
|
|
28565
28106
|
this._syncLoopAction = void 0;
|
|
@@ -28569,7 +28110,7 @@ ${s1}
|
|
|
28569
28110
|
}
|
|
28570
28111
|
this.flushSyncStdoutBatch(io);
|
|
28571
28112
|
if (!enteredBody) rawState.status = 0;
|
|
28572
|
-
return {
|
|
28113
|
+
return { ...progress, lastInductionVal };
|
|
28573
28114
|
}
|
|
28574
28115
|
_syncLoopFnCheckDepth = 0;
|
|
28575
28116
|
canSyncReadOnlyArraySubscripts(tree, rawState) {
|
|
@@ -28738,7 +28279,7 @@ ${s1}
|
|
|
28738
28279
|
rawState.positional = savedPos;
|
|
28739
28280
|
}
|
|
28740
28281
|
}
|
|
28741
|
-
execSyncFnStep(step, rawState, io, monitor, touched, mode,
|
|
28282
|
+
execSyncFnStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28742
28283
|
const fnCall = step.fnCall;
|
|
28743
28284
|
const fnArgs = [];
|
|
28744
28285
|
for (let i = 0; i < fnCall.argWords.length; i++) {
|
|
@@ -28774,12 +28315,14 @@ ${s1}
|
|
|
28774
28315
|
}
|
|
28775
28316
|
}
|
|
28776
28317
|
if (fnCall.steps.length > 0) {
|
|
28777
|
-
this.execSyncLoopSteps(fnCall.steps, rawState, io, monitor, touched, mode,
|
|
28318
|
+
this.execSyncLoopSteps(fnCall.steps, rawState, io, monitor, touched, mode, progress);
|
|
28778
28319
|
} else {
|
|
28779
28320
|
rawState.status = 0;
|
|
28780
28321
|
}
|
|
28781
28322
|
rawState.lastArgument = fnArgs.at(-1) ?? fnCall.name;
|
|
28782
|
-
|
|
28323
|
+
progress.lastCmd = step.cmd;
|
|
28324
|
+
progress.lastArg = rawState.lastArgument;
|
|
28325
|
+
progress.pipelineStatus = rawState.status;
|
|
28783
28326
|
} finally {
|
|
28784
28327
|
for (let i = savedLocals.length - 1; i >= 0; i--) {
|
|
28785
28328
|
const saved = savedLocals[i];
|
|
@@ -28795,16 +28338,10 @@ ${s1}
|
|
|
28795
28338
|
this._fastSubPositional = prevFastSubPos;
|
|
28796
28339
|
}
|
|
28797
28340
|
}
|
|
28798
|
-
execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode,
|
|
28341
|
+
execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28799
28342
|
const nl = step.nestedLoop;
|
|
28800
28343
|
const lc = nl.loopCmd;
|
|
28801
|
-
let innerLastCmd;
|
|
28802
|
-
let innerLastArg = "";
|
|
28803
28344
|
let innerStatus = 0;
|
|
28804
|
-
const updateInner = (v) => {
|
|
28805
|
-
innerLastCmd = v.lastCmd;
|
|
28806
|
-
innerLastArg = v.lastArg;
|
|
28807
|
-
};
|
|
28808
28345
|
rawState.loopDepth++;
|
|
28809
28346
|
try {
|
|
28810
28347
|
if (lc.kind === "arithmetic-for") {
|
|
@@ -28817,7 +28354,7 @@ ${s1}
|
|
|
28817
28354
|
while (this.syncShellArithmeticNonZero(e1, rawState, nl.condLine)) {
|
|
28818
28355
|
this.budget.loop();
|
|
28819
28356
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28820
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28357
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28821
28358
|
innerStatus = rawState.status;
|
|
28822
28359
|
if (this._syncLoopAction !== void 0) {
|
|
28823
28360
|
const act = this._syncLoopAction;
|
|
@@ -28834,7 +28371,7 @@ ${s1}
|
|
|
28834
28371
|
this.budget.loop();
|
|
28835
28372
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28836
28373
|
rawState.variables[lc.name] = words[i];
|
|
28837
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28374
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28838
28375
|
innerStatus = rawState.status;
|
|
28839
28376
|
if (this._syncLoopAction !== void 0) {
|
|
28840
28377
|
const act = this._syncLoopAction;
|
|
@@ -28847,15 +28384,14 @@ ${s1}
|
|
|
28847
28384
|
while (true) {
|
|
28848
28385
|
this.budget.tick();
|
|
28849
28386
|
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
|
-
}
|
|
28387
|
+
progress.lastCmd = nl.condCmd;
|
|
28388
|
+
if (nl.condCmd?.kind === "simple") progress.lastArg = this.fastValueWord(nl.condCmd.words[nl.condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28854
28389
|
rawState.status = condOk ? 0 : 1;
|
|
28390
|
+
progress.pipelineStatus = rawState.status;
|
|
28855
28391
|
if (condOk !== (lc.kind === "while")) break;
|
|
28856
28392
|
this.budget.loop();
|
|
28857
28393
|
if ((++turn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
28858
|
-
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode,
|
|
28394
|
+
this.execSyncLoopSteps(nl.steps, rawState, io, monitor, touched, mode, progress);
|
|
28859
28395
|
innerStatus = rawState.status;
|
|
28860
28396
|
if (this._syncLoopAction !== void 0) {
|
|
28861
28397
|
const act = this._syncLoopAction;
|
|
@@ -28868,16 +28404,15 @@ ${s1}
|
|
|
28868
28404
|
rawState.loopDepth--;
|
|
28869
28405
|
}
|
|
28870
28406
|
rawState.status = innerStatus;
|
|
28871
|
-
if (innerLastCmd) onUpdate({ lastCmd: innerLastCmd, lastArg: innerLastArg });
|
|
28872
28407
|
}
|
|
28873
|
-
execSyncCaseStep(step, rawState, io, monitor, touched, mode,
|
|
28408
|
+
execSyncCaseStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28874
28409
|
const subj = this.fastValueWord(step.caseSubject, rawState, io, false, false, false, false, 0, step.line);
|
|
28875
28410
|
const work = { remaining: this.budget.limits.maxExpansionBytes, signal: this.signal, exhausted: () => this.budget.fail("maxExpansionBytes") };
|
|
28876
28411
|
let chosen;
|
|
28877
28412
|
for (let ci = 0; ci < step.caseClauses.length; ci++) {
|
|
28878
28413
|
const cl = step.caseClauses[ci];
|
|
28879
28414
|
for (let pi = 0; pi < cl.patterns.length; pi++) {
|
|
28880
|
-
const pattern =
|
|
28415
|
+
const pattern = this.tryBuildSyncPatternWord(cl.patterns[pi], rawState, io, step.line);
|
|
28881
28416
|
if (pattern !== void 0 && tryMatchesPatternSync(pattern, subj, work, false, false)) {
|
|
28882
28417
|
chosen = cl.steps;
|
|
28883
28418
|
break;
|
|
@@ -28888,17 +28423,19 @@ ${s1}
|
|
|
28888
28423
|
if (!chosen) {
|
|
28889
28424
|
rawState.status = 0;
|
|
28890
28425
|
} else {
|
|
28891
|
-
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode,
|
|
28426
|
+
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode, progress);
|
|
28892
28427
|
}
|
|
28893
28428
|
}
|
|
28894
|
-
execSyncIfStep(step, rawState, io, monitor, touched, mode,
|
|
28429
|
+
execSyncIfStep(step, rawState, io, monitor, touched, mode, progress) {
|
|
28895
28430
|
let chosen;
|
|
28896
28431
|
for (let bi = 0; bi < step.ifBranches.length; bi++) {
|
|
28897
28432
|
const br = step.ifBranches[bi];
|
|
28898
28433
|
this.budget.tick();
|
|
28899
28434
|
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
|
-
|
|
28435
|
+
progress.lastCmd = br.condCmd;
|
|
28436
|
+
if (br.condCmd.kind === "simple") progress.lastArg = this.fastValueWord(br.condCmd.words[br.condCmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28901
28437
|
rawState.status = condOk ? 0 : 1;
|
|
28438
|
+
progress.pipelineStatus = rawState.status;
|
|
28902
28439
|
if (condOk) {
|
|
28903
28440
|
chosen = br.steps;
|
|
28904
28441
|
break;
|
|
@@ -28908,90 +28445,48 @@ ${s1}
|
|
|
28908
28445
|
if (!chosen) {
|
|
28909
28446
|
rawState.status = 0;
|
|
28910
28447
|
} else {
|
|
28911
|
-
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode,
|
|
28448
|
+
this.execSyncLoopSteps(chosen, rawState, io, monitor, touched, mode, progress);
|
|
28912
28449
|
}
|
|
28913
28450
|
}
|
|
28914
|
-
execSyncLoopSteps(steps, rawState, io, monitor, touched, mode,
|
|
28915
|
-
let lastCmd;
|
|
28916
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28451
|
+
execSyncLoopSteps(steps, rawState, io, monitor, touched, mode, progress, deferredMask = 0) {
|
|
28917
28452
|
for (let b = 0; b < steps.length; b++) {
|
|
28918
28453
|
const step = steps[b];
|
|
28919
28454
|
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
28455
|
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
|
-
});
|
|
28456
|
+
if (step.nestedLoop !== void 0 || step.fnCall !== void 0 || step.caseClauses !== void 0 || step.ifBranches !== void 0) {
|
|
28457
|
+
this.flushSyncStdoutBatch(io);
|
|
28458
|
+
if (step.nestedLoop !== void 0) this.execSyncNestedLoopStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28459
|
+
else if (step.fnCall !== void 0) this.execSyncFnStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28460
|
+
else if (step.caseClauses !== void 0) this.execSyncCaseStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28461
|
+
else this.execSyncIfStep(step, rawState, io, monitor, touched, mode, progress);
|
|
28981
28462
|
if (this._syncLoopAction !== void 0) break;
|
|
28982
28463
|
continue;
|
|
28464
|
+
}
|
|
28465
|
+
progress.lastCmd = step.cmd;
|
|
28466
|
+
let status = 0;
|
|
28467
|
+
if (step.loopAction !== void 0) {
|
|
28468
|
+
progress.lastArg = step.cmd.words[step.cmd.words.length - 1].plain;
|
|
28469
|
+
this._syncLoopAction = step.loopAction;
|
|
28470
|
+
} else if (step.unsetVars !== void 0) {
|
|
28471
|
+
progress.lastArg = this.execSyncUnsetStep(step, rawState, monitor, touched);
|
|
28472
|
+
} else if (step.localDecl !== void 0) {
|
|
28473
|
+
progress.lastArg = this.execSyncLocalDeclStep(step.localDecl, rawState, io, monitor, touched, step.line);
|
|
28474
|
+
} else if (step.shiftCount !== void 0) {
|
|
28475
|
+
const result = this.execSyncShiftStep(step.shiftCount, step.cmd, rawState);
|
|
28476
|
+
progress.lastArg = result.lastArg;
|
|
28477
|
+
status = result.status;
|
|
28478
|
+
} else if (step.readHereString !== void 0) {
|
|
28479
|
+
progress.lastArg = this.execSyncReadHereStringStep(step.readHereString, step, rawState, io, monitor, touched);
|
|
28480
|
+
status = rawState.status;
|
|
28481
|
+
} else if (deferredMask & 1 << b) {
|
|
28482
|
+
progress.lastArg = "";
|
|
28983
28483
|
} else if (step.condStmt !== void 0) {
|
|
28984
|
-
|
|
28484
|
+
status = this.tryEvalConditionalSync(step.condStmt, rawState, monitor, arrayStore(rawState), io, step.line) ?? 1;
|
|
28985
28485
|
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 });
|
|
28486
|
+
progress.lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
|
|
28988
28487
|
}
|
|
28989
|
-
rawState.status = cStatus;
|
|
28990
|
-
continue;
|
|
28991
28488
|
} else if (step.arithStmt !== void 0) {
|
|
28992
|
-
|
|
28993
|
-
rawState.status = nonZero ? 0 : 1;
|
|
28994
|
-
continue;
|
|
28489
|
+
status = this.evalSyncLoopArithStmt(step.arithStmt, rawState, io, touched, step.line) ? 0 : 1;
|
|
28995
28490
|
} else if (step.coalesceNext) {
|
|
28996
28491
|
const nextStep = steps[++b];
|
|
28997
28492
|
this.budget.tick();
|
|
@@ -29000,42 +28495,42 @@ ${s1}
|
|
|
29000
28495
|
this.budget.fileSystemOperation();
|
|
29001
28496
|
this.budget.fileSystemOperation();
|
|
29002
28497
|
this.budget.bytes += encoded.byteLength;
|
|
29003
|
-
lastCmd = nextStep.cmd;
|
|
29004
|
-
lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io);
|
|
28498
|
+
progress.lastCmd = nextStep.cmd;
|
|
28499
|
+
progress.lastArg = this.evalSyncRedirectWord(nextStep.value, rawState, io);
|
|
29005
28500
|
} else if (step.targetWord !== void 0 && step.value !== void 0) {
|
|
29006
28501
|
if (this.isSimpleRedirectEchoWord(step.value)) {
|
|
29007
28502
|
const encoded = this.encodeSyncRedirectWordsToScratch(step.value, void 0, rawState, io);
|
|
29008
28503
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29009
28504
|
this.budget.fileSystemOperation();
|
|
29010
28505
|
this.budget.bytes += encoded.byteLength;
|
|
29011
|
-
lastArg = this.evalSyncRedirectWord(step.value, rawState, io);
|
|
28506
|
+
progress.lastArg = this.evalSyncRedirectWord(step.value, rawState, io);
|
|
29012
28507
|
} else {
|
|
29013
28508
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29014
28509
|
const encoded = fastSharedTextEncoder.encode(this.formatSyncEchoLine(val));
|
|
29015
28510
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29016
28511
|
this.budget.fileSystemOperation();
|
|
29017
28512
|
this.budget.bytes += encoded.byteLength;
|
|
29018
|
-
lastArg = val;
|
|
28513
|
+
progress.lastArg = val;
|
|
29019
28514
|
}
|
|
29020
28515
|
} else if (step.targetWord !== void 0 && step.printfVArgs !== void 0) {
|
|
29021
|
-
const { formatted: formatted2, lastArg
|
|
28516
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29022
28517
|
const encoded = fastSharedTextEncoder.encode(formatted2);
|
|
29023
28518
|
this.writeSyncRedirectStep(step, encoded, step.append, mode, rawState, io);
|
|
29024
28519
|
this.budget.fileSystemOperation();
|
|
29025
28520
|
this.budget.bytes += encoded.byteLength;
|
|
29026
|
-
lastArg =
|
|
28521
|
+
progress.lastArg = lastArg;
|
|
29027
28522
|
} else if (step.arrayAssign !== void 0) {
|
|
29028
28523
|
if (!this.tryFastArrayAssignmentSync(step.arrayAssign, rawState, io, step.line, void 0, void 0, true)) {
|
|
29029
28524
|
throw new Error("Synchronous loop array assignment was not executable");
|
|
29030
28525
|
}
|
|
29031
|
-
lastArg = "";
|
|
28526
|
+
progress.lastArg = "";
|
|
29032
28527
|
} else if (step.printfVArgs !== void 0 && step.name !== void 0) {
|
|
29033
|
-
const { formatted: formatted2, lastArg
|
|
28528
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29034
28529
|
rawState.variables[step.name] = formatted2;
|
|
29035
28530
|
touched.add(step.name);
|
|
29036
|
-
lastArg =
|
|
28531
|
+
progress.lastArg = lastArg;
|
|
29037
28532
|
} else if (step.isDiscardDevNull && step.discardWords !== void 0) {
|
|
29038
|
-
lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
28533
|
+
progress.lastArg = this.runSyncDiscardStep(step, rawState, io);
|
|
29039
28534
|
} else if (step.name !== void 0 && step.value !== void 0) {
|
|
29040
28535
|
rawState.substitutionStatus = 0;
|
|
29041
28536
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
@@ -29045,165 +28540,32 @@ ${s1}
|
|
|
29045
28540
|
rawState.variables[step.name] = (typeof curStr === "string" ? curStr : "") + val;
|
|
29046
28541
|
} else rawState.variables[step.name] = val;
|
|
29047
28542
|
touched.add(step.name);
|
|
29048
|
-
lastArg = "";
|
|
28543
|
+
progress.lastArg = "";
|
|
28544
|
+
status = rawState.substitutionStatus;
|
|
29049
28545
|
} else if (step.isStdoutEcho && step.value !== void 0) {
|
|
29050
28546
|
const val = this.fastValueWord(step.value, rawState, io, false, false, false, false, 0, step.line);
|
|
29051
28547
|
this.writeSyncStdoutText(this.formatSyncEchoLine(val), io);
|
|
29052
|
-
lastArg = val;
|
|
28548
|
+
progress.lastArg = val;
|
|
29053
28549
|
} else if (step.isStdoutEcho && step.printfVArgs !== void 0) {
|
|
29054
|
-
const { formatted: formatted2, lastArg
|
|
28550
|
+
const { formatted: formatted2, lastArg } = this.evalSyncPrintfStep(step.printfVArgs, rawState, io, step.line, step.cmd.words[0]?.plain === "echo");
|
|
29055
28551
|
this.writeSyncStdoutText(formatted2, io);
|
|
29056
|
-
lastArg =
|
|
28552
|
+
progress.lastArg = lastArg;
|
|
29057
28553
|
} else {
|
|
29058
|
-
lastArg = step.cmd.words[0].plain;
|
|
28554
|
+
progress.lastArg = step.cmd.words[0].plain;
|
|
29059
28555
|
}
|
|
29060
|
-
rawState.status =
|
|
29061
|
-
|
|
28556
|
+
rawState.status = status;
|
|
28557
|
+
progress.pipelineStatus = status;
|
|
28558
|
+
if (this._syncLoopAction !== void 0) break;
|
|
29062
28559
|
}
|
|
29063
28560
|
}
|
|
29064
28561
|
runSyncForFallback(varName, fastLoopWords, bodyAssignments, rawState, io, monitor, touched, mode) {
|
|
29065
|
-
|
|
29066
|
-
let lastArg = rawState.lastArgument ?? "";
|
|
28562
|
+
const progress = { lastCmd: void 0, lastArg: rawState.lastArgument ?? "", pipelineStatus: void 0 };
|
|
29067
28563
|
let loopTurn = 0;
|
|
29068
28564
|
for (let idx = 0; idx < fastLoopWords.length; idx++) {
|
|
29069
28565
|
this.budget.loop();
|
|
29070
28566
|
if ((++loopTurn & 127) === 0) runYieldCheckpoint(this.signal);
|
|
29071
28567
|
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
|
-
}
|
|
28568
|
+
this.execSyncLoopSteps(bodyAssignments, rawState, io, monitor, touched, mode, progress);
|
|
29207
28569
|
if (this._syncLoopAction !== void 0) {
|
|
29208
28570
|
const act = this._syncLoopAction;
|
|
29209
28571
|
this._syncLoopAction = void 0;
|
|
@@ -29211,7 +28573,7 @@ ${s1}
|
|
|
29211
28573
|
}
|
|
29212
28574
|
}
|
|
29213
28575
|
this.flushSyncStdoutBatch(io);
|
|
29214
|
-
return
|
|
28576
|
+
return progress;
|
|
29215
28577
|
}
|
|
29216
28578
|
async script(script, state, io, startListIndex = 0, startPipelineIndex = 0, skipFirstSync = false) {
|
|
29217
28579
|
if (state.extensions?.syntax.indexedDeclarations?.includes("readonly")) io.assignmentDiagnosticContext ??= { name: void 0 };
|
|
@@ -29492,13 +28854,12 @@ ${s1}
|
|
|
29492
28854
|
try {
|
|
29493
28855
|
const isFastPure = isPureStage || runtime.isPureExternalStageCommand(command, rawStateForChild);
|
|
29494
28856
|
const forkedExt = isFastPure ? forkExtensions(state.extensions, "pipeline") : void 0;
|
|
29495
|
-
const child = isFastPure ? Object.assign(
|
|
28857
|
+
const child = isFastPure ? Object.assign(cloneRawState(rawStateForChild, false), {
|
|
29496
28858
|
extensions: forkedExt,
|
|
29497
28859
|
isolated: true,
|
|
29498
28860
|
_readOnlyStage: true
|
|
29499
28861
|
}) : tryCloneStateSync(state) ?? await cloneState(state, this.signal);
|
|
29500
28862
|
preparedChild = child;
|
|
29501
|
-
if (child._readOnlyStage) child.variables = { ...child.variables };
|
|
29502
28863
|
child.variables.BASH_SUBSHELL = String(Number(state.variables.BASH_SUBSHELL ?? 0) + 1);
|
|
29503
28864
|
if (!child._readOnlyStage) {
|
|
29504
28865
|
child.extensions = void 0;
|
|
@@ -29756,7 +29117,7 @@ ${s1}
|
|
|
29756
29117
|
}
|
|
29757
29118
|
}
|
|
29758
29119
|
}
|
|
29759
|
-
const extDef = this.
|
|
29120
|
+
const extDef = this.commands.get(firstName);
|
|
29760
29121
|
return extDef !== void 0 && !customRegisteredCommands.has(extDef.execute) && !customRegisteredRegistries.has(this.commands);
|
|
29761
29122
|
}
|
|
29762
29123
|
publishStatus(state, statuses, io, terminal) {
|
|
@@ -30031,7 +29392,7 @@ ${s1}
|
|
|
30031
29392
|
}
|
|
30032
29393
|
for (let pIdx = 0; pIdx < clause.patterns.length; pIdx++) {
|
|
30033
29394
|
const pw = clause.patterns[pIdx];
|
|
30034
|
-
const pStr =
|
|
29395
|
+
const pStr = this.tryBuildSyncPatternWord(pw, state, originalIO, diagnosticLine);
|
|
30035
29396
|
if (pStr === void 0) {
|
|
30036
29397
|
allFast = false;
|
|
30037
29398
|
break;
|
|
@@ -31710,7 +31071,7 @@ ${s1}
|
|
|
31710
31071
|
}
|
|
31711
31072
|
}
|
|
31712
31073
|
const scope = io[invocationScope].child();
|
|
31713
|
-
const externalDef = typeof name2 === "string" ? this.
|
|
31074
|
+
const externalDef = typeof name2 === "string" ? this.commands.get(name2) : void 0;
|
|
31714
31075
|
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
31076
|
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
31077
|
try {
|
|
@@ -32158,7 +31519,7 @@ ${s1}
|
|
|
32158
31519
|
return { exitCode: builtin };
|
|
32159
31520
|
}
|
|
32160
31521
|
}
|
|
32161
|
-
const definition = this.
|
|
31522
|
+
const definition = this.commands.get(context2.command);
|
|
32162
31523
|
if (context2.command === "printf" && definition?.execute === printfCommand.execute && context2.args[0]?.startsWith("-v")) {
|
|
32163
31524
|
ensureRuntimeContext();
|
|
32164
31525
|
return { exitCode: await this.printfVariable(context2, state, assignments2) };
|
|
@@ -32235,7 +31596,7 @@ ${s1}
|
|
|
32235
31596
|
const matches = [];
|
|
32236
31597
|
if (!bypassFunctions && state.functions.has(name2)) matches.push({ kind: "function", name: name2 });
|
|
32237
31598
|
if (implementedBuiltins.has(name2) || state.extensions?.builtins.has(name2)) matches.push({ kind: "builtin", name: name2 });
|
|
32238
|
-
else if (this.
|
|
31599
|
+
else if (this.commands.has(name2)) matches.push({ kind: "command", name: name2 });
|
|
32239
31600
|
else if (name2 === "bash" || name2 === "sh") matches.push({ kind: "interpreter", name: name2 });
|
|
32240
31601
|
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
31602
|
return matches;
|
|
@@ -32277,19 +31638,10 @@ ${s1}
|
|
|
32277
31638
|
if (isBuiltin && state.profile === "sh" && (specialBuiltinNames.has(name2) || state.extensions?.builtins.get(name2)?.special)) return "builtin";
|
|
32278
31639
|
if (!bypassFunctions && state.functions.has(name2)) return "function";
|
|
32279
31640
|
if (isBuiltin) return "builtin";
|
|
32280
|
-
if (this.
|
|
31641
|
+
if (this.commands.has(name2)) return "command";
|
|
32281
31642
|
if (name2 === "bash" || name2 === "sh") return "interpreter";
|
|
32282
31643
|
return void 0;
|
|
32283
31644
|
}
|
|
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
31645
|
async discoveryBuiltin(context, state, io, assignments2, inheritedDefaultPath = false) {
|
|
32294
31646
|
const args = [...context.args];
|
|
32295
31647
|
const command = context.command === "command";
|
|
@@ -35653,7 +35005,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
35653
35005
|
const name2 = this.referenceName(state, part.name);
|
|
35654
35006
|
const binding = arrayStore(state)?.get(name2);
|
|
35655
35007
|
const index = binding?.associative ? binding.keys.get("30")?.index ?? -1 : 0;
|
|
35656
|
-
retained = binding?.getValue(index) ?? stateMonitor(state)?.values.get(name2, value) ?? value;
|
|
35008
|
+
retained = name2 === "RANDOM" || name2 === "SECONDS" || name2 === "LINENO" ? value : binding?.getValue(index) ?? stateMonitor(state)?.values.get(name2, value) ?? value;
|
|
35657
35009
|
} else if (/^0+$/u.test(part.name)) retained = stateMonitor(state)?.positionals.get(zeroPositionKey, value) ?? value;
|
|
35658
35010
|
else if (/^[0-9]+$/u.test(part.name)) retained = stateMonitor(state)?.positionals.get(String(Number(part.name) - 1), value) ?? value;
|
|
35659
35011
|
else if (part.name === "@" || part.name === "*") {
|
|
@@ -35984,6 +35336,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
35984
35336
|
let out = "";
|
|
35985
35337
|
for (let i = 0; i < word.parts.length; i++) {
|
|
35986
35338
|
let resolvedPart = word.parts[i];
|
|
35339
|
+
if (resolvedPart.kind === "variable" && (resolveSyncNameref(rawState, resolvedPart.name) === "RANDOM" || resolveSyncNameref(rawState, resolvedPart.name) === "SECONDS")) return void 0;
|
|
35987
35340
|
if (resolvedPart.kind === "variable" && !resolvedPart.prefixNames && rawState.variableAttributes?.get(resolvedPart.name)?.includes("n")) {
|
|
35988
35341
|
if (resolvedPart.indirect) return void 0;
|
|
35989
35342
|
const resolvedName = resolveSyncNameref(rawState, resolvedPart.name);
|
|
@@ -36535,7 +35888,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
36535
35888
|
let trimGlobRe;
|
|
36536
35889
|
if (!patQuoted && hasGlobOrEscape(pat, !!rawState.extglob)) {
|
|
36537
35890
|
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);
|
|
35891
|
+
if (isPrefixTrim && pat.charCodeAt(0) === 42 && !(rawState.extglob && pat.charCodeAt(1) === 40) && !hasGlobOrEscape(pat.slice(1), !!rawState.extglob)) starWildcardLit = pat.slice(1);
|
|
36539
35892
|
else if (!isPrefixTrim && pat.charCodeAt(pat.length - 1) === 42 && !hasGlobOrEscape(pat.slice(0, -1), !!rawState.extglob)) starWildcardLit = pat.slice(0, -1);
|
|
36540
35893
|
else {
|
|
36541
35894
|
trimGlobRe = tryCompileTrimGlobToRegex(pat, part.operator, !!rawState.extglob);
|
|
@@ -36688,6 +36041,7 @@ ${prefix} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
36688
36041
|
}
|
|
36689
36042
|
} else if (part.kind === "substitution") {
|
|
36690
36043
|
if (split && !part.quoted) return void 0;
|
|
36044
|
+
if (!this._syncLoopInvariantSubMap?.has(part)) return void 0;
|
|
36691
36045
|
const substVal = this.tryFastPureSubstitution(part, state, rawState, io);
|
|
36692
36046
|
if (substVal === void 0) return void 0;
|
|
36693
36047
|
out += substVal;
|
|
@@ -43736,7 +43090,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43736
43090
|
const p = word.parts[i];
|
|
43737
43091
|
if (p.kind === "text") continue;
|
|
43738
43092
|
if (p.kind === "variable") {
|
|
43739
|
-
if (p.name === "BASH_SUBSHELL") return false;
|
|
43093
|
+
if (p.name === "BASH_SUBSHELL" || p.name === "RANDOM" || p.name === "SECONDS") return false;
|
|
43740
43094
|
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
43095
|
const activePos = this._fastSubPositional ?? rawState.positional;
|
|
43742
43096
|
if (rawState.nounset && p.name >= "1" && p.name <= "9" && activePos[p.name.charCodeAt(0) - 49] === void 0) return false;
|
|
@@ -43750,15 +43104,14 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43750
43104
|
continue;
|
|
43751
43105
|
}
|
|
43752
43106
|
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;
|
|
43107
|
+
return false;
|
|
43756
43108
|
}
|
|
43757
43109
|
return false;
|
|
43758
43110
|
}
|
|
43759
43111
|
return true;
|
|
43760
43112
|
}
|
|
43761
43113
|
tryFastPureSubstitution(part, state, rawState, io) {
|
|
43114
|
+
if (this.budget.limits.maxInputBytes !== Infinity) return void 0;
|
|
43762
43115
|
const cachedInv = this._syncLoopInvariantSubMap?.get(part);
|
|
43763
43116
|
if (cachedInv !== void 0 && !cachedInv.dynamic) {
|
|
43764
43117
|
const nextTotalBytes = this.budget.bytes + cachedInv.outBytes;
|
|
@@ -43791,7 +43144,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43791
43144
|
const name2 = command.words[0]?.plain;
|
|
43792
43145
|
if (!name2) continue;
|
|
43793
43146
|
if (name2 === "fmt" && command === pipeline.commands[0] && command.redirects.length === 0 && !io.stdinIsDefault) return void 0;
|
|
43794
|
-
const definition = this.
|
|
43147
|
+
const definition = this.commands.get(name2);
|
|
43795
43148
|
if (definition && customRegisteredCommands.has(definition.execute)) return void 0;
|
|
43796
43149
|
if (name2 === "uname" || name2 === "nproc" || name2 === "hostname" || name2 === "id" || name2 === "whoami") {
|
|
43797
43150
|
if (!definition || !builtInDirectContextExecutors.has(definition.execute)) return void 0;
|
|
@@ -43814,7 +43167,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43814
43167
|
}
|
|
43815
43168
|
if (cmd0HereStringRedir && w0Plain0 === "cat" && cmd0.words.length !== 1) return void 0;
|
|
43816
43169
|
if (!cmd0StdinRedir && !cmd0HereStringRedir && w0Plain0 === "cat" && cmd0.words.length < 2) return void 0;
|
|
43817
|
-
const def0 =
|
|
43170
|
+
const def0 = this.commands.get(w0Plain0);
|
|
43818
43171
|
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
43172
|
if (!this.arePureArgWords(cmd0.words, rawState)) return void 0;
|
|
43820
43173
|
const n = pipeline.commands.length;
|
|
@@ -43827,7 +43180,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
43827
43180
|
if (sCmd.kind !== "simple" || (i > 0 ? sCmd.redirects.length !== 0 : !cmd0StdinRedir && !cmd0HereStringRedir && !cmd0FileStage) || sCmd.words.length === 0) return void 0;
|
|
43828
43181
|
const sName = sCmd.words[0].plain;
|
|
43829
43182
|
if (!sName || hasShellFunction(rawState, sName) || rawState.extensions?.builtins.has(sName)) return void 0;
|
|
43830
|
-
const extDef = this.
|
|
43183
|
+
const extDef = this.commands.get(sName);
|
|
43831
43184
|
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
43185
|
if ((sName === "xxd" || sName === "od") && !builtInDirectContextExecutors.has(extDef.execute)) return void 0;
|
|
43833
43186
|
if (!this.arePureArgWords(sCmd.words, rawState)) return void 0;
|
|
@@ -44038,7 +43391,9 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44038
43391
|
}
|
|
44039
43392
|
if (stage0Formatted === void 0 || stage0Formatted.length > 8192) return void 0;
|
|
44040
43393
|
const stage0ByteLen = shellValueByteLength(stage0Formatted);
|
|
44041
|
-
if (stage0ByteLen >
|
|
43394
|
+
if (stage0ByteLen > 65536) return void 0;
|
|
43395
|
+
const sharedSyncPipeBuf0 = new Uint8Array(65536);
|
|
43396
|
+
const sharedSyncPipeBuf1 = new Uint8Array(65536);
|
|
44042
43397
|
const nextBytes0 = this.budget.bytes + stage0ByteLen;
|
|
44043
43398
|
if (nextBytes0 > this.budget.maxOutputBytesSmi && stage0ByteLen > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
44044
43399
|
const previousBytes = this.budget.bytes;
|
|
@@ -44758,7 +44113,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44758
44113
|
for (const cl of cmd.clauses) {
|
|
44759
44114
|
let matched = false;
|
|
44760
44115
|
for (const pw of cl.patterns) {
|
|
44761
|
-
if (pw.plain !== void 0 && tryMatchesPatternSync(pw.plain, subj, work, false, false) === true) {
|
|
44116
|
+
if (pw.plain !== void 0 && !pw.plain.startsWith("~") && tryMatchesPatternSync(pw.plain, subj, work, false, false) === true) {
|
|
44762
44117
|
matched = true;
|
|
44763
44118
|
break;
|
|
44764
44119
|
}
|
|
@@ -44783,19 +44138,19 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44783
44138
|
if (!w0Plain || rawState.extensions?.builtins.has(w0Plain)) return void 0;
|
|
44784
44139
|
if (w0Plain === "fmt" && !hasSingleStdinRedir && !hasSingleHereStringRedir && !io.stdinIsDefault) return void 0;
|
|
44785
44140
|
if (w0Plain === "xxd" || w0Plain === "od" || w0Plain === "mktemp" || w0Plain === "chmod" || w0Plain === "uname" || w0Plain === "nproc" || w0Plain === "hostname" || w0Plain === "id" || w0Plain === "whoami") {
|
|
44786
|
-
const definition = this.
|
|
44141
|
+
const definition = this.commands.get(w0Plain);
|
|
44787
44142
|
if (!definition || !builtInDirectContextExecutors.has(definition.execute)) return void 0;
|
|
44788
44143
|
}
|
|
44789
44144
|
if (cmd.words.length === 2 && cmd.redirects.length === 0 && (cmd.words[1]?.plain === "--help" || cmd.words[1]?.plain === "--version")) {
|
|
44790
44145
|
const gnuInfo = gnuInformationSync(w0Plain, [cmd.words[1].plain], false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== void 0);
|
|
44791
44146
|
if (gnuInfo !== void 0) {
|
|
44792
|
-
const extDef = this.
|
|
44147
|
+
const extDef = this.commands.get(w0Plain);
|
|
44793
44148
|
if (!extDef || !builtInDirectContextExecutors.has(extDef.execute)) return void 0;
|
|
44794
44149
|
return gnuInfo.replace(/\n+$/, "");
|
|
44795
44150
|
}
|
|
44796
44151
|
}
|
|
44797
44152
|
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.
|
|
44153
|
+
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
44154
|
const allArgs = [];
|
|
44800
44155
|
let fOk = true;
|
|
44801
44156
|
for (let i = 1; i < cmd.words.length; i++) {
|
|
@@ -44909,7 +44264,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44909
44264
|
}
|
|
44910
44265
|
}
|
|
44911
44266
|
if (fOk && (w0Plain === "date" || w0Plain === "printenv" || w0Plain === "env") && !hasSingleStdinRedir && !hasSingleHereStringRedir) {
|
|
44912
|
-
const ext = this.
|
|
44267
|
+
const ext = this.commands.get(w0Plain);
|
|
44913
44268
|
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
44269
|
if (dpOut !== void 0 && !dpOut.includes("\0")) {
|
|
44915
44270
|
let res = dpOut;
|
|
@@ -44929,7 +44284,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
44929
44284
|
if (fOk && (w0Plain === "df" || w0Plain === "du" || w0Plain === "tree" || w0Plain === "stat" || w0Plain === "fd" || w0Plain === "readlink" || w0Plain === "realpath" || w0Plain === "ls" || w0Plain === "find") && !hasSingleStdinRedir && !hasSingleHereStringRedir) {
|
|
44930
44285
|
const inspectNode = (p) => this.tryInspectMemoryNodeSync(p, true);
|
|
44931
44286
|
const inspectStat = (p, follow) => this.tryInspectMemoryNodeSync(p, true, follow);
|
|
44932
|
-
const vfsOut = w0Plain === "df" ? evalSyncDf(allArgs, rawState.cwd, rawState.variables, inspectNode, this.
|
|
44287
|
+
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
44288
|
if (vfsOut !== void 0 && !vfsOut.includes("\0")) {
|
|
44934
44289
|
let res = vfsOut;
|
|
44935
44290
|
const outBytes = shellValueByteLength(res);
|
|
@@ -45107,7 +44462,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45107
44462
|
} catch {
|
|
45108
44463
|
return false;
|
|
45109
44464
|
}
|
|
45110
|
-
}) : w0Plain === "gh" ? syncCommandEvaluators.evalSyncGh?.(this.
|
|
44465
|
+
}) : 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
44466
|
try {
|
|
45112
44467
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45113
44468
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45157,7 +44512,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45157
44512
|
} catch {
|
|
45158
44513
|
return false;
|
|
45159
44514
|
}
|
|
45160
|
-
}) : w0Plain === "ssconvert" ? syncCommandEvaluators.evalSyncSsconvert?.(this.
|
|
44515
|
+
}) : w0Plain === "ssconvert" ? syncCommandEvaluators.evalSyncSsconvert?.(this.commands.get("ssconvert").execute, allArgs, optInBytes, readFile, (p, b) => {
|
|
45161
44516
|
try {
|
|
45162
44517
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45163
44518
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45177,7 +44532,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45177
44532
|
} catch {
|
|
45178
44533
|
return false;
|
|
45179
44534
|
}
|
|
45180
|
-
}) : w0Plain === "op" ? syncCommandEvaluators.evalSyncOp?.(this.
|
|
44535
|
+
}) : 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
44536
|
try {
|
|
45182
44537
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45183
44538
|
const dir = p.slice(0, p.lastIndexOf("/")) || "/";
|
|
@@ -45835,7 +45190,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45835
45190
|
}
|
|
45836
45191
|
});
|
|
45837
45192
|
} else if (w0Plain === "gh") {
|
|
45838
|
-
fileRes = syncCommandEvaluators.evalSyncGh?.(this.
|
|
45193
|
+
fileRes = syncCommandEvaluators.evalSyncGh?.(this.commands.get("gh").execute, opArgs, rawState.variables, rawState.cwd, (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), false));
|
|
45839
45194
|
} else if (w0Plain === "pdftoppm") {
|
|
45840
45195
|
const readFile = (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true);
|
|
45841
45196
|
fileRes = syncCommandEvaluators.evalSyncPdftoppm?.(view, opArgs, readFile, (p, b) => {
|
|
@@ -45902,7 +45257,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45902
45257
|
}
|
|
45903
45258
|
});
|
|
45904
45259
|
} else if (w0Plain === "ssconvert") {
|
|
45905
|
-
fileRes = syncCommandEvaluators.evalSyncSsconvert?.(this.
|
|
45260
|
+
fileRes = syncCommandEvaluators.evalSyncSsconvert?.(this.commands.get("ssconvert").execute, opArgs, view, (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true), (p, b) => {
|
|
45906
45261
|
try {
|
|
45907
45262
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45908
45263
|
const fp = resolvePath(rawState.cwd, p);
|
|
@@ -45927,9 +45282,9 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
45927
45282
|
}
|
|
45928
45283
|
});
|
|
45929
45284
|
} else if (w0Plain === "op") {
|
|
45930
|
-
fileRes = syncCommandEvaluators.evalSyncOp?.(this.
|
|
45285
|
+
fileRes = syncCommandEvaluators.evalSyncOp?.(this.commands.get("op").execute, opArgs, rawState.variables);
|
|
45931
45286
|
} 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.
|
|
45287
|
+
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
45288
|
try {
|
|
45934
45289
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
45935
45290
|
const dir = p.slice(0, p.lastIndexOf("/")) || "/";
|
|
@@ -46336,6 +45691,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46336
45691
|
}
|
|
46337
45692
|
let fnPositional;
|
|
46338
45693
|
if (rawState.functions.has(w0Plain)) {
|
|
45694
|
+
if (rawState.functionDepth >= this.budget.limits.maxFunctionDepth) return void 0;
|
|
46339
45695
|
if (rawState.depth + 1 >= this.budget.limits.maxSubstitutionDepth) return void 0;
|
|
46340
45696
|
const fnBody = rawState.functions.get(w0Plain);
|
|
46341
45697
|
if (fnBody.kind !== "group" || fnBody.redirects.length !== 0) return void 0;
|
|
@@ -46365,7 +45721,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46365
45721
|
const disc = typeof targetName === "string" ? this.tryResolveSyncDiscovery(w0Plain === "command" ? "name" : "kind", targetName, rawState) : void 0;
|
|
46366
45722
|
if (disc !== void 0 && (disc.status === 0 || !rawState.errexit)) {
|
|
46367
45723
|
if (disc.status === 0) {
|
|
46368
|
-
const byteLength2 =
|
|
45724
|
+
const byteLength2 = shellValueByteLength(disc.text) + 1;
|
|
46369
45725
|
const nextBytes2 = this.budget.bytes + byteLength2;
|
|
46370
45726
|
if (nextBytes2 > this.budget.maxOutputBytesSmi && byteLength2 > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
46371
45727
|
this.budget.bytes = nextBytes2;
|
|
@@ -46380,7 +45736,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46380
45736
|
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
45737
|
let res = rawState.cwd;
|
|
46382
45738
|
while (res.endsWith("\n")) res = res.slice(0, -1);
|
|
46383
|
-
const byteLength2 =
|
|
45739
|
+
const byteLength2 = shellValueByteLength(res) + 1;
|
|
46384
45740
|
const nextBytes2 = this.budget.bytes + byteLength2;
|
|
46385
45741
|
if (nextBytes2 > this.budget.maxOutputBytesSmi && byteLength2 > this.budget.limits.maxOutputBytes - this.budget.bytes) this.budget.fail("maxOutputBytes");
|
|
46386
45742
|
this.budget.bytes = nextBytes2;
|
|
@@ -46391,7 +45747,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
46391
45747
|
return res;
|
|
46392
45748
|
}
|
|
46393
45749
|
if (w0Plain !== "printf" && w0Plain !== "echo" && w0Plain !== "dirname" && w0Plain !== "basename" && w0Plain !== "seq") return void 0;
|
|
46394
|
-
const def =
|
|
45750
|
+
const def = this.commands.get(w0Plain);
|
|
46395
45751
|
if (!def) return void 0;
|
|
46396
45752
|
if (w0Plain === "printf" && def.execute !== printfCommand.execute) return void 0;
|
|
46397
45753
|
if (w0Plain === "echo" && !defaultEchoExecutors.has(def.execute)) return void 0;
|
|
@@ -47296,6 +46652,7 @@ var RootShellState = class {
|
|
|
47296
46652
|
this.status = 0;
|
|
47297
46653
|
this.substitutionStatus = 0;
|
|
47298
46654
|
this.lastArgument = "";
|
|
46655
|
+
this.secondsOrigin = Date.now();
|
|
47299
46656
|
}
|
|
47300
46657
|
get exported() {
|
|
47301
46658
|
const raw = stateMonitor(this)?.raw;
|
|
@@ -47611,8 +46968,6 @@ var EMPTY_CAPTURED_EXTENSIONS = captureShellExtensions([]);
|
|
|
47611
46968
|
var sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
47612
46969
|
var sharedUtf8Encoder = new TextEncoder();
|
|
47613
46970
|
var EMPTY_SHELL_BYTES = new Uint8Array(0);
|
|
47614
|
-
var _cachedFastResultStdout = "\0";
|
|
47615
|
-
var _cachedFastResultPromise;
|
|
47616
46971
|
var FastShellResult = class {
|
|
47617
46972
|
constructor(stdout, stderr, exitCode) {
|
|
47618
46973
|
this.stdout = typeof stdout === "string" ? stdout : sharedUtf8Decoder.decode(stdout);
|
|
@@ -47648,7 +47003,6 @@ var EMPTY_STDIN_OPTIONS = Object.freeze({
|
|
|
47648
47003
|
});
|
|
47649
47004
|
var EMPTY_EXEC_OPTIONS = Object.freeze({});
|
|
47650
47005
|
var EMPTY_STDOUT_BYTES = new Uint8Array(0);
|
|
47651
|
-
var _execAnchor = new Array(13);
|
|
47652
47006
|
var warmSyncExecJitWarmed = false;
|
|
47653
47007
|
var parsedSourceCache = /* @__PURE__ */ new Map();
|
|
47654
47008
|
var lastSourceCacheKey = "";
|
|
@@ -48117,26 +47471,6 @@ var Shell = class _Shell {
|
|
|
48117
47471
|
let unit = firstCached.unit;
|
|
48118
47472
|
let exitCode = 0;
|
|
48119
47473
|
while (true) {
|
|
48120
|
-
if (currentCachedUnit !== void 0 && (unit.script._fastConstEcho !== void 0 || currentCachedUnit.nextCached !== void 0 && currentCachedUnit.nextCached.unit.script._fastConstEcho !== void 0)) {
|
|
48121
|
-
const batchEnd = runtime.tryRunFastConstEchoBatch(currentCachedUnit, source.length, currentState, io);
|
|
48122
|
-
if (batchEnd !== void 0) {
|
|
48123
|
-
currentCachedUnit = batchEnd;
|
|
48124
|
-
unit = batchEnd.unit;
|
|
48125
|
-
exitCode = 0;
|
|
48126
|
-
if (unit.next >= source.length) break;
|
|
48127
|
-
budget.signal.throwIfAborted();
|
|
48128
|
-
const vars2 = currentState.variables;
|
|
48129
|
-
const nextLocale2 = vars2.LC_ALL || vars2.LC_CTYPE || vars2.LANG ? byteLocale(vars2) : false;
|
|
48130
|
-
const nextCached2 = currentCachedUnit.locale === nextLocale2 ? currentCachedUnit.nextCached : void 0;
|
|
48131
|
-
if (nextCached2 !== void 0 && (!nextCached2.unit.script.warnings || nextCached2.unit.script.warnings.length === 0)) {
|
|
48132
|
-
currentCachedUnit = nextCached2;
|
|
48133
|
-
budget.parsing.admit(nextCached2.unitsCharged);
|
|
48134
|
-
unit = nextCached2.unit;
|
|
48135
|
-
continue;
|
|
48136
|
-
}
|
|
48137
|
-
return this.#continueWarmAsync(source, options, warm, sourceCache, void 0, unit, currentCachedUnit, exitCode);
|
|
48138
|
-
}
|
|
48139
|
-
}
|
|
48140
47474
|
if (unit.script.lists.length) {
|
|
48141
47475
|
const unitResult = runtime.runUnit(unit.script, currentState, io);
|
|
48142
47476
|
if (unitResult instanceof Promise) {
|
|
@@ -48176,30 +47510,6 @@ var Shell = class _Shell {
|
|
|
48176
47510
|
void scope.close();
|
|
48177
47511
|
}
|
|
48178
47512
|
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
47513
|
return Promise.resolve(new FastShellResult(stdoutOutput, stderrOutput, exitCode));
|
|
48204
47514
|
} catch (error) {
|
|
48205
47515
|
return this.#failWarmAsync(warm, error);
|
|
@@ -48525,6 +47835,7 @@ var Shell = class _Shell {
|
|
|
48525
47835
|
}
|
|
48526
47836
|
variables.OPTIND = "1";
|
|
48527
47837
|
variables.OPTERR = "1";
|
|
47838
|
+
variables.IFS ??= " \n";
|
|
48528
47839
|
currentState = new RootShellState(
|
|
48529
47840
|
cwd,
|
|
48530
47841
|
variables,
|
|
@@ -48655,9 +47966,8 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
48655
47966
|
void monitor.proxy.variables;
|
|
48656
47967
|
monitor.values.prewarm();
|
|
48657
47968
|
stdout.enableScratchBuffer();
|
|
48658
|
-
stderr.enableScratchBuffer(
|
|
47969
|
+
stderr.enableScratchBuffer();
|
|
48659
47970
|
void runtime.canFastMemoryRedirect;
|
|
48660
|
-
preverifyMemoryRgTree(runtime.backingFs);
|
|
48661
47971
|
this.#warmedInvocation = {
|
|
48662
47972
|
budget,
|
|
48663
47973
|
scope,
|
|
@@ -48727,9 +48037,6 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
48727
48037
|
dispose() {
|
|
48728
48038
|
if (this.#disposal) return this.#disposal;
|
|
48729
48039
|
this.#disposed = true;
|
|
48730
|
-
_execAnchor.fill(void 0);
|
|
48731
|
-
_cachedFastResultStdout = "\0";
|
|
48732
|
-
_cachedFastResultPromise = void 0;
|
|
48733
48040
|
Runtime.clearStaticPools();
|
|
48734
48041
|
clearAwkReaderPool();
|
|
48735
48042
|
clearRgFastRunnerPool();
|
|
@@ -48765,82 +48072,6 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
48765
48072
|
}
|
|
48766
48073
|
};
|
|
48767
48074
|
|
|
48768
|
-
// packages/safe-bash/src/shell/worker-limits.ts
|
|
48769
|
-
init_platform();
|
|
48770
|
-
var cloudflareWorkerLimits = Object.freeze({
|
|
48771
|
-
maxEnvSplitBytes: 131072,
|
|
48772
|
-
maxEnvSplitArguments: 1e4,
|
|
48773
|
-
maxEnvSplitExpansions: 32,
|
|
48774
|
-
maxEnvSplitWork: 1048576,
|
|
48775
|
-
maxDirectoryStackBytes: 4194304,
|
|
48776
|
-
maxDirectoryDiagnosticBytes: 65792,
|
|
48777
|
-
commandLimits: Object.freeze({ archive: Object.freeze({
|
|
48778
|
-
maxArchiveBytes: 4 * 1024 * 1024,
|
|
48779
|
-
maxInputMemoryBytes: 8 * 1024 * 1024,
|
|
48780
|
-
maxEntryBytes: 4 * 1024 * 1024,
|
|
48781
|
-
maxTotalBytes: 8 * 1024 * 1024,
|
|
48782
|
-
maxMembers: 1e3,
|
|
48783
|
-
maxPathBytes: 4 * 1024,
|
|
48784
|
-
maxDepth: 64,
|
|
48785
|
-
maxPaxBytes: 64 * 1024,
|
|
48786
|
-
maxFilesFromBytes: 256 * 1024,
|
|
48787
|
-
maxArgumentBytes: 256 * 1024,
|
|
48788
|
-
maxTextBytes: 4 * 1024 * 1024,
|
|
48789
|
-
maxDiagnosticBytes: 4 * 1024,
|
|
48790
|
-
maxPatternSteps: 1e6,
|
|
48791
|
-
maxBufferedFileBytes: 4 * 1024 * 1024,
|
|
48792
|
-
chunkSize: 16 * 1024
|
|
48793
|
-
}), htmlToMarkdown: Object.freeze({
|
|
48794
|
-
maxInputBytes: 4 * 1024 * 1024,
|
|
48795
|
-
maxOutputBytes: 4 * 1024 * 1024,
|
|
48796
|
-
maxTokenBytes: 64 * 1024,
|
|
48797
|
-
maxTokens: 3e4,
|
|
48798
|
-
maxNodes: 1e4,
|
|
48799
|
-
maxDepth: 64,
|
|
48800
|
-
maxAttributes: 64,
|
|
48801
|
-
maxTableCells: 1e4,
|
|
48802
|
-
maxTableCellBytes: 64 * 1024,
|
|
48803
|
-
maxFiles: 64,
|
|
48804
|
-
maxArgumentBytes: 256 * 1024,
|
|
48805
|
-
maxDiagnosticBytes: 4 * 1024,
|
|
48806
|
-
maxWorkUnits: 32 * 1024 * 1024
|
|
48807
|
-
}), split: Object.freeze({ maxSuffixLength: 255 }) }),
|
|
48808
|
-
maxSyntaxDepth: 64,
|
|
48809
|
-
maxAdmittedHandles: 64,
|
|
48810
|
-
maxDescriptorOperations: 16,
|
|
48811
|
-
maxDescriptorReadBytes: 65536,
|
|
48812
|
-
maxCdWork: 8388608,
|
|
48813
|
-
maxCdPathBytes: 65536,
|
|
48814
|
-
maxCdProbes: 4097,
|
|
48815
|
-
maxCdPathComponents: 4096,
|
|
48816
|
-
maxDirectoryStackEntries: 4096,
|
|
48817
|
-
maxDirectoryStackOutputBytes: 65536,
|
|
48818
|
-
maxGlobstarStates: 1e5,
|
|
48819
|
-
maxGlobstarDepth: 128,
|
|
48820
|
-
maxGlobstarEntries: 1e5,
|
|
48821
|
-
maxParseUnits: 65536,
|
|
48822
|
-
maxInputBytes: 4 * 1024 * 1024,
|
|
48823
|
-
maxOutputBytes: 4 * 1024 * 1024,
|
|
48824
|
-
maxCommands: 1e3,
|
|
48825
|
-
maxFileSystemOperations: 1e4,
|
|
48826
|
-
maxPathComponents: 64,
|
|
48827
|
-
maxPathnameComponents: 64,
|
|
48828
|
-
maxRedirects: 64,
|
|
48829
|
-
maxPipelineStages: 64,
|
|
48830
|
-
maxLoopIterations: 1e3,
|
|
48831
|
-
maxSubstitutionDepth: 16,
|
|
48832
|
-
maxFunctionDepth: 16,
|
|
48833
|
-
maxSourceBytes: 256 * 1024,
|
|
48834
|
-
maxExpansionFields: 1e3,
|
|
48835
|
-
maxExpansionBytes: 4 * 1024 * 1024,
|
|
48836
|
-
maxWallClockMs: 1e4,
|
|
48837
|
-
maxCpuMs: 1e4,
|
|
48838
|
-
pipeHighWaterMark: 16 * 1024
|
|
48839
|
-
});
|
|
48840
|
-
|
|
48841
|
-
// packages/safe-bash/src/shell/index.ts
|
|
48842
|
-
init_platform();
|
|
48843
|
-
|
|
48844
48075
|
export {
|
|
48845
48076
|
createMemoryFileSystem,
|
|
48846
48077
|
defaultMemoryFileSystemLimits,
|
|
@@ -48866,6 +48097,5 @@ export {
|
|
|
48866
48097
|
createSearchCommands,
|
|
48867
48098
|
searchCommands,
|
|
48868
48099
|
evalSyncRg,
|
|
48869
|
-
Shell
|
|
48870
|
-
cloudflareWorkerLimits
|
|
48100
|
+
Shell
|
|
48871
48101
|
};
|