From f1a245a8a9bbbf358846e9683af8f40cf0f01028 Mon Sep 17 00:00:00 2001 From: Cottand <45274424+Cottand@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:03:48 +0100 Subject: [PATCH] fix argv0 not being passed to ForkExec also - changes examples to include the aws-nitro-util in `../` rather than fetching it from github - adds arg to example so we show using arguments in `cmd` --- examples/flake.lock | 15 ++++++--------- examples/flake.nix | 2 +- examples/withShellScript.nix | 8 ++++++-- init/init.go | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/examples/flake.lock b/examples/flake.lock index b772e95..6aa915c 100644 --- a/examples/flake.lock +++ b/examples/flake.lock @@ -44,17 +44,14 @@ ] }, "locked": { - "lastModified": 1714745550, - "narHash": "sha256-ralB0D0tG9ERgjRlit7t2pRI5lclnqOcqclzqj41EN4=", - "owner": "monzo", - "repo": "aws-nitro-util", - "rev": "00f74d348d8f5fbf3f2fc4edf018e20d6b9a7144", - "type": "github" + "lastModified": 0, + "narHash": "sha256-9ui9jwz/cjxkvl38/dacy0tM6WZohx7kh3rIXtbG7eA=", + "path": "../", + "type": "path" }, "original": { - "owner": "monzo", - "repo": "aws-nitro-util", - "type": "github" + "path": "../", + "type": "path" } }, "nixpkgs": { diff --git a/examples/flake.nix b/examples/flake.nix index cad5ead..0eea73a 100644 --- a/examples/flake.nix +++ b/examples/flake.nix @@ -2,7 +2,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nitro-util.url = "github:monzo/aws-nitro-util"; + nitro-util.url = "path:../"; nitro-util.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; diff --git a/examples/withShellScript.nix b/examples/withShellScript.nix index 1b498ee..85c345a 100644 --- a/examples/withShellScript.nix +++ b/examples/withShellScript.nix @@ -12,7 +12,7 @@ let while true; do - echo "hello there!"; + echo "hello there $1 !"; sleep 3; done ''; @@ -33,6 +33,10 @@ nitro.buildEif { pathsToLink = [ "/bin" ]; }; - entrypoint = "/bin/hello"; + entrypoint = '' + /bin/hello + nico + ''; + env = ""; } diff --git a/init/init.go b/init/init.go index ff9560c..ffa0f52 100644 --- a/init/init.go +++ b/init/init.go @@ -368,7 +368,7 @@ func main() { die("failed to init cgroups", err) } - pid, err := launch(cmd[0], cmd[1:], env) + pid, err := launch(cmd[0], cmd, env) if err != nil { die("failed to launch", err)