From fb5c261c700d451ffb78e107c83cc1b3b445c22a Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Thu, 21 Dec 2023 11:08:32 +0100 Subject: [PATCH] Add -b for batch mode Since the CI has no terminal, all tests fail. --- flake.nix | 1 + penrun | 15 +++++++++------ penrun.1.rst | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 2f18901..a5156a7 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ devShell.x86_64-linux = pkgs.mkShell { buildInputs = with pkgs; [ bats + nodePackages_latest.bash-language-server ]; shellHook = '' LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [stdenv.cc.cc]} diff --git a/penrun b/penrun index bace1a4..fd80426 100755 --- a/penrun +++ b/penrun @@ -276,6 +276,7 @@ usage() { echo " -C CMD Compression command for OUTPUT" echo " -S SEC Sleep this time beetween jobs" echo " -T TPL A command template for batch processing" + echo " -b Use batched mode for parallel processing. Commands are read from stdin." echo " -c FILE Use this config file exclusively" echo " -d DIR Use artifactsdir DIR" echo " -e EXT File extension for OUTPUT" @@ -295,6 +296,7 @@ dienocmd() { main() { local artifactsdir="" + local batch_mode="" local forced_config="" local jobs="1" local run_until="0" @@ -304,11 +306,12 @@ main() { local template="" local use_default_args="1" - while getopts "C:S:T:c:d:e:j:np:st:uh" arg; do + while getopts "C:S:T:bc:d:e:j:np:st:uh" arg; do case "$arg" in C) read -r -a PENRUN_COMPRESSION_COMMAND <<<"$OPTARG" ;; S) sleep_time="$OPTARG" ;; T) template="$OPTARG" ;; + b) batch_mode=1;; c) forced_config="$OPTARG" ;; d) artifactsdir="$OPTARG" ;; e) PENRUN_OUTPUT_EXTENSION="$OPTARG" ;; @@ -332,12 +335,12 @@ main() { fi local cmds - if [[ ! -t 0 ]]; then + if (( batch_mode )); then mapfile -t cmds