Skip to content

Commit

Permalink
preset HOME to simplify octez-* interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Apr 18, 2024
1 parent 4ce6802 commit 757ea5e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions containers/tezos/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV ASCEND_SOCKET=/var/run/ascend.socket
ENV ASCEND_LOGS=/var/log/ascend
ENV ASCEND_INIT="tezbox init --setup-services"
ENV TEZBOX_USER=tezos
ENV HOME=/tezbox/data

RUN printf '#!/bin/sh\n\
if [ -z "$GITHUB_TOKEN" ]; then\n\
Expand Down
12 changes: 11 additions & 1 deletion src/box/octez.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function octez.client.run(args, options)
if type(options) ~= "table" then options = {} end
if type(args) ~= "table" then args = {} end

log_debug("Running octez client with args: " .. string.join(" ", args))

return proc.spawn(env.octezClientBinary, args, {
username = options.user or env.user,
wait = true,
Expand Down Expand Up @@ -58,6 +60,8 @@ function octez.node.run(args, options)
if type(options) ~= "table" then options = {} end
if type(args) ~= "table" then args = {} end

log_debug("Running octez node with args: " .. string.join(" ", args))

return proc.spawn(env.octezNodeBinary, args, {
username = options.user or env.user,
wait = true,
Expand Down Expand Up @@ -112,9 +116,15 @@ function octez.exec_with_node_running(exec, options)
"--sandbox=" .. path.combine(env.contextDirectory, "sandbox.json"),
}

local overrideEnv = {}
if env.homeDirectory == os.getenv("HOME") then
overrideEnv = { HOME = "/tmp" } -- octez node refuses to use HOME in sandbox mode so we need to override it to proceed
end

local nodeProc = proc.spawn(env.octezNodeBinary, args, {
username = options.user or env.user,
stdio = "inherit"
stdio = "inherit",
env = buildEnv(overrideEnv),
}) --[[@as EliProcess]]

local executed = false
Expand Down
2 changes: 1 addition & 1 deletion src/version-info.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local TEZBOX_VERSIOn = "0.1.2"
local TEZBOX_VERSIOn = "0.1.3"

return {
VERSION = TEZBOX_VERSIOn,
Expand Down

0 comments on commit 757ea5e

Please sign in to comment.