mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 03:48:56 +00:00
Replace some of std.ChildProcess with bun.spawnSync (#9513)
* Replace some of std.ChildProcess with bun.spawnSync * Update process.zig * Fix some build errors * Fix linux build * Keep error * Don't print a mesasge in this case * Update spawn.test.ts * Make `bun install` faster on Linux * Comments + edgecases * Fix the tests * Add bun install launch.json --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Zack Radisic <zack@theradisic.com>
This commit is contained in:
@@ -23,6 +23,10 @@ pub fn initCapacity(
|
||||
};
|
||||
}
|
||||
|
||||
pub fn countZ(this: *StringBuilder, slice: string) void {
|
||||
this.cap += slice.len + 1;
|
||||
}
|
||||
|
||||
pub fn count(this: *StringBuilder, slice: string) void {
|
||||
this.cap += slice.len;
|
||||
}
|
||||
@@ -50,6 +54,22 @@ pub fn append16(this: *StringBuilder, slice: []const u16) ?[:0]u8 {
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn appendZ(this: *StringBuilder, slice: string) [:0]const u8 {
|
||||
if (comptime Environment.allow_assert) {
|
||||
assert(this.len + 1 <= this.cap); // didn't count everything
|
||||
assert(this.ptr != null); // must call allocate first
|
||||
}
|
||||
|
||||
bun.copy(u8, this.ptr.?[this.len..this.cap], slice);
|
||||
this.ptr.?[this.len + slice.len] = 0;
|
||||
const result = this.ptr.?[this.len..this.cap][0..slice.len :0];
|
||||
this.len += slice.len + 1;
|
||||
|
||||
if (comptime Environment.allow_assert) assert(this.len <= this.cap);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn append(this: *StringBuilder, slice: string) string {
|
||||
if (comptime Environment.allow_assert) {
|
||||
assert(this.len <= this.cap); // didn't count everything
|
||||
|
||||
Reference in New Issue
Block a user