Read MIM_SOCKET in mimctl mode
This commit is contained in:
+11
-2
@@ -11,7 +11,7 @@ const help_text =
|
|||||||
\\Usage:
|
\\Usage:
|
||||||
\\ mim [--help]
|
\\ mim [--help]
|
||||||
\\ mim [--version]
|
\\ mim [--version]
|
||||||
\\ mim --mimctl <socket> <request...>
|
\\ mim --mimctl <socket|-> <request...>
|
||||||
\\
|
\\
|
||||||
\\This early build exposes the canonical smoke path and a minimal local
|
\\This early build exposes the canonical smoke path and a minimal local
|
||||||
\\session-control client for trusted tools.
|
\\session-control client for trusted tools.
|
||||||
@@ -62,7 +62,16 @@ pub fn main(init: std.process.Init) !u8 {
|
|||||||
try stderr.writeStreamingAll(init.io, "mim: --mimctl requires a request\n");
|
try stderr.writeStreamingAll(init.io, "mim: --mimctl requires a request\n");
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
const response = socket.request(allocator, socket_path, line) catch {
|
const resolved_socket_path = if (std.mem.eql(u8, socket_path, "-"))
|
||||||
|
std.process.Environ.getAlloc(init.minimal.environ, allocator, socket.socket_env_name) catch {
|
||||||
|
try stderr.writeStreamingAll(init.io, "mim: MIM_SOCKET is not set\n");
|
||||||
|
return 69;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
try allocator.dupe(u8, socket_path);
|
||||||
|
defer allocator.free(resolved_socket_path);
|
||||||
|
|
||||||
|
const response = socket.request(allocator, resolved_socket_path, line) catch {
|
||||||
try stderr.writeStreamingAll(init.io, "mim: mimctl request failed\n");
|
try stderr.writeStreamingAll(init.io, "mim: mimctl request failed\n");
|
||||||
return 69;
|
return 69;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user