aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
AgeCommit message (Collapse)Author
2022-07-25std.mem: add `first` method to `SplitIterator` and `SplitBackwardsIterator`r00ster
2022-07-01Sema: validate deref operator type and valueVeikka Tuominen
2022-05-11document that on Windows, all key arguments in EnvMap must be valid utf8Jonathan Marler
2022-05-11incorporate review changes from squeekJonathan Marler
2022-05-11some fixes to the EnvMap HashContextJonathan Marler
2022-05-11reverse some of the now unneeded changes from squeekJonathan Marler
2022-05-11add unicode supportJonathan Marler
2022-05-11remove extra storage from EnvMap on windowsJonathan Marler
2022-05-11EnvMapWindows: Fix putUtf8 not uppercasing keysRyan Liptak
2022-05-11Set EnvMap.Size to BufMap.BufMapHashMap.SizeRyan Liptak
Now that BufMap.BufMapHashMap is pub, we can just get Size directly
2022-05-11Update usages of `process.getEnvMap` and change BufMap -> EnvMap where ↵Jonathan Marler
applicable # Conflicts: # lib/std/build/RunStep.zig
2022-05-11Add `process.EnvMap`, a platform-independent environment variable mapRyan Liptak
EnvMap provides the same API as the previously used BufMap (besides `putMove` and `getPtr`), so usage sites of `getEnvMap` can usually remain unchanged. For non-Windows, EnvMap is a wrapper around BufMap. On Windows, it uses a new EnvMapWindows to handle some Windows-specific behavior: - Lookups use Unicode-aware case insensitivity (but `get` cannot return an error because EnvMapWindows has an internal buffer to use for lookup conversions) - Canonical names are returned when iterating the EnvMap Fixes #10561, closes #4603
2022-02-06Avoid depending on child process execution when not supported by host OSCody Tapscott
In accordance with the requesting issue (#10750): - `zig test` skips any tests that it cannot spawn, returning success - `zig run` and `zig build` exit with failure, reporting the command the cannot be run - `zig clang`, `zig ar`, etc. already punt directly to the appropriate clang/lld main(), even before this change - Native `libc` Detection is not supported Additionally, `exec()` and related Builder functions error at run-time, reporting the command that cannot be run
2022-02-05std.process: add option to support single quotes to ArgIteratorGeneralVeikka Tuominen
2022-01-30Full response file (*.rsp) supportPhaseMage
I hit the "quotes in an RSP file" issue when trying to compile gRPC using "zig cc". As a fun exercise, I decided to see if I could fix it myself. I'm fully open to this code being flat-out rejected. Or I can take feedback to fix it up. This modifies (and renames) _ArgIteratorWindows_ in process.zig such that it works with arbitrary strings (or the contents of an RSP file). In main.zig, this new _ArgIteratorGeneral_ is used to address the "TODO" listed in _ClangArgIterator_. This change closes #4833. **Pros:** - It has the nice attribute of handling "RSP file" arguments in the same way it handles "cmd_line" arguments. - High Performance, minimal allocations - Fixed bug in previous _ArgIteratorWindows_, where final trailing backslashes in a command line were entirely dropped - Added a test case for the above bug - Harmonized the _ArgIteratorXxxx._initWithAllocator()_ and _next()_ interface across Windows/Posix/Wasi (Moved Windows errors to _initWithAllocator()_ rather than _next()_) - Likely perf benefit on Windows by doing _utf16leToUtf8AllocZ()_ only once for the entire cmd_line **Cons:** - Breaking Change in std library on Windows: Call _ArgIterator.initWithAllocator()_ instead of _ArgIterator.init()_ - PhaseMage is new with contributions to Zig, might need a lot of hand-holding - PhaseMage is a Windows person, non-Windows stuff will need to be double-checked **Testing Done:** - Wrote a few new test cases in process.zig - zig.exe build test -Dskip-release (no new failures seen) - zig cc now builds gRPC without error
2022-01-29fix argsAlloc buffer sizeJean Dao
The buffer `buf` contains N (= `slice_sizes.len`) slices followed by the N null-terminated arguments. The N null-terminated arguments are stored in the `contents` array list. Thus, `buf` size should be: @sizeOf([]u8) * slice_sizes.len + contents_slice.len Instead of: @sizeOf([]u8) * slice_sizes.len + contents_slice.len + slice_sizes.len This bug was found thanks to the gpa allocator which checks if freed size matches allocated sizes for large allocations.
2022-01-20remove unnecessary self argumentJonathan Marler
2021-12-21Change `ArgIterator.next()` return typeominitay
Changes the return type of `ArgIterator.next()` from `?(NextError![:0]u8)` to `NextError!?[:0]u8`.
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-24Initial bringup of the Solaris/Illumos portStephen Gregoratto
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-08-09Merge remote-tracking branch 'origin' into libc-wasi-testTakeshi Yoneda
2021-08-06Update all usages of mem.split/mem.tokenize for generic versionRyan Liptak
2021-07-27WASI,libc: enable tests.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-08Add support for NO_COLORMartin Wickham
2021-06-21fix code broken from previous commitJacob G-W
2021-06-03Breaking hash map changes for 0.8.0Martin Wickham
- hash/eql functions moved into a Context object - *Context functions pass an explicit context - *Adapted functions pass specialized keys and contexts - new getPtr() function returns a pointer to value - remove functions renamed to fetchRemove - new remove functions return bool - removeAssertDiscard deleted, use assert(remove(...)) instead - Keys and values are stored in separate arrays - Entry is now {*K, *V}, the new KV is {K, V} - BufSet/BufMap functions renamed to match other set/map types - fixed iterating-while-modifying bug in src/link/C.zig
2021-05-24avoid usage of execv on HaikuAl Hoang
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-02-25initial support for haiku continue clean upAl Hoang
* remove unused definitions * setup os specific blocks
2021-02-25initial support for haiku past stage0Al Hoang
2021-01-02std: Use {s} instead of {} when printing stringsLemonBoy
2020-12-31Year++Frank Denis
2020-12-28std.process: update arg iterator testsAndrew Kelley
These tests asserted there were no args passed to the test binary, but now there is an arg intentionally passed to the test binary, so the test case needed to be updated.
2020-12-27std: clean up sentinel handling for argv/environIsaac Freund
2020-12-26std: do not call malloc() between fork() and execv()Andrew Kelley
We were violating the POSIX standard which resulted in a deadlock on musl v1.1.24 on aarch64 alpine linux, uncovered with the new ThreadPool usage in the stage2 compiler. std.os execv functions that accept an Allocator parameter are removed because they are footguns. The POSIX standard does not allow calls to malloc() between fork() and execv() and since it is common to both (1) call execv() after fork() and (2) use std.heap.c_allocator, Programmers are encouraged to go through the `std.process` API instead, causing some dissonance when combined with `std.os` APIs. I also slapped a big warning message on all the relevant doc comments.
2020-11-30Switch to using unicode when parsing the command line on windows (#7241)Rageoholic
* Switch to using unicode when parsing the command line on windows * Apply changes by LemonBoy and *hopefully* fix tests on MIPs Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com> * Fix up next and skip * Move comment to more relevant place Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com>
2020-11-07remove deprecated uses of ArrayList.spanJosh Holland
2020-10-22Make argsAlloc/ArgIterator return zero-sentinel strings (#6720)chwayne
2020-10-17Merge branch 'master' into openbsd-minimalSebastien Marie
2020-10-12Rename .macosx to .macosVignesh Rajagopalan
2020-10-11add minimal openbsd supportSébastien Marie
2020-09-10std: fix bitrot in process.posixGetUserInfo()Isaac Freund
2020-09-03std: fix linux uid_t, use uid_t/gid_t in std.osIsaac Freund
- correct uid_t from i32 to u32 on linux - define uid_t and gid_t for OSes missing definitions - use uid_t/gid_t instead of plain u32s throughout std.os
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-07-04std.mem.dupe is deprecated, move all references in stdjoachimschmidt557
Replaced all occurences of std.mem.dupe in stdlib with Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ