From: Matthias Kruk Date: Sun, 25 Jul 2021 04:31:16 +0000 (+0900) Subject: include/context: Move files when adding them to a context X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=0645118056f09d1dd235ac6afb0292986e4f4a55;p=foundry include/context: Move files when adding them to a context When adding files (or logs) to a context, the files are placed in a context-specific directory using cp. This causes copies of the files to be left behind in the working directories of the generating processes, requiring additional cleanup if the copies are not needed anymore. However, in the majority of cases, the copy is not needed. This commit modifies the foundry_context_add_file() and foundry_context_add_log() functions so that mv is used to place the files in the context's directory, doing away with the need to clean up the working directories of the generating processes. --- diff --git a/dispatchbot.sh b/dispatchbot.sh index 0a0f895..b4cf26f 100755 --- a/dispatchbot.sh +++ b/dispatchbot.sh @@ -341,6 +341,8 @@ _route_messages() { } main() { + opt_add_arg "n" "name" "rv" "" "The name of this instance" + if ! opt_parse "$@"; then return 1 fi diff --git a/include/context.sh b/include/context.sh index d542530..90432d3 100644 --- a/include/context.sh +++ b/include/context.sh @@ -82,7 +82,7 @@ foundry_context_add_file() { return 1 fi - if ! cp "$file" "$file_path/."; then + if ! mv "$file" "$file_path/."; then return 1 fi @@ -128,7 +128,7 @@ foundry_context_add_log() { return 1 fi - if ! cp "$log" "$logdir/."; then + if ! mv "$log" "$logdir/."; then return 1 fi