Skip to content

Commit

Permalink
allow running process-compose in detached mode, then attaching and st…
Browse files Browse the repository at this point in the history
…opping afterwards
  • Loading branch information
VanCoding committed Sep 29, 2024
1 parent cd3e722 commit 5b66d08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions example/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
};

# nix run .#ponysay up to start the process
# nun run .#ponysay attach to show the output
# nix run .#ponysay down to stop the process
packages.ponysay = (import ../nix/eval-modules.nix).makeProcessCompose {
inherit pkgs;
name = "ponysay";
Expand Down
10 changes: 9 additions & 1 deletion nix/process-compose/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ in
text = ''
${preHook}
set -x; process-compose ${arguments.global} ${arguments.up}"$@"; set +x
params=(${arguments.global})
set +u
if [ -z "$1" ] || [[ "$1" == "up" ]] || [[ "$1" == -* ]] ; then
params+=(${arguments.up})
fi
set -x;
process-compose "''${params[@]}" "$@";
set +x
${postHook}
'';
Expand Down

0 comments on commit 5b66d08

Please sign in to comment.