std.ChildProcess.init
cannot error
This commit is contained in:
parent
106e3cd963
commit
4f04f7dac0
@ -1454,8 +1454,7 @@ fn formattingHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, req:
|
|||||||
return try respondGeneric(id, null_result_response);
|
return try respondGeneric(id, null_result_response);
|
||||||
};
|
};
|
||||||
|
|
||||||
var process = try std.ChildProcess.init(&[_][]const u8{ zig_exe_path, "fmt", "--stdin" }, allocator);
|
var process = std.ChildProcess.init(&[_][]const u8{ zig_exe_path, "fmt", "--stdin" }, allocator);
|
||||||
defer process.deinit();
|
|
||||||
process.stdin_behavior = .Pipe;
|
process.stdin_behavior = .Pipe;
|
||||||
process.stdout_behavior = .Pipe;
|
process.stdout_behavior = .Pipe;
|
||||||
|
|
||||||
@ -1656,7 +1655,7 @@ pub fn main() anyerror!void {
|
|||||||
// Check arguments.
|
// Check arguments.
|
||||||
var args_it = try std.process.ArgIterator.initWithAllocator(allocator);
|
var args_it = try std.process.ArgIterator.initWithAllocator(allocator);
|
||||||
defer args_it.deinit();
|
defer args_it.deinit();
|
||||||
if(!args_it.skip()) @panic("Could not find self argument");
|
if (!args_it.skip()) @panic("Could not find self argument");
|
||||||
|
|
||||||
var config_path: ?[]const u8 = null;
|
var config_path: ?[]const u8 = null;
|
||||||
var next_arg_config_path = false;
|
var next_arg_config_path = false;
|
||||||
|
@ -13,7 +13,7 @@ const initialize_msg_offs =
|
|||||||
;
|
;
|
||||||
|
|
||||||
const Server = struct {
|
const Server = struct {
|
||||||
process: *std.ChildProcess,
|
process: std.ChildProcess,
|
||||||
request_id: u32 = 1,
|
request_id: u32 = 1,
|
||||||
|
|
||||||
fn start(initialization: []const u8, expect: ?[]const u8) !Server {
|
fn start(initialization: []const u8, expect: ?[]const u8) !Server {
|
||||||
@ -103,12 +103,11 @@ const Server = struct {
|
|||||||
// FIXME this shutdown request fails with a broken pipe on stdin on the CI
|
// FIXME this shutdown request fails with a broken pipe on stdin on the CI
|
||||||
self.request("shutdown", "{}", null) catch @panic("Could not send shutdown request");
|
self.request("shutdown", "{}", null) catch @panic("Could not send shutdown request");
|
||||||
// waitNoError(self.process) catch @panic("Server error");
|
// waitNoError(self.process) catch @panic("Server error");
|
||||||
self.process.deinit();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fn startZls() !*std.ChildProcess {
|
fn startZls() !std.ChildProcess {
|
||||||
var process = try std.ChildProcess.init(&[_][]const u8{"zig-out/bin/zls" ++ suffix}, allocator);
|
var process = std.ChildProcess.init(&[_][]const u8{"zig-out/bin/zls" ++ suffix}, allocator);
|
||||||
process.stdin_behavior = .Pipe;
|
process.stdin_behavior = .Pipe;
|
||||||
process.stdout_behavior = .Pipe;
|
process.stdout_behavior = .Pipe;
|
||||||
process.stderr_behavior = .Inherit;
|
process.stderr_behavior = .Inherit;
|
||||||
|
Loading…
Reference in New Issue
Block a user