]> git.corax.cc Git - foundry/commitdiff
include/context: Move files when adding them to a context
authorMatthias Kruk <m@m10k.eu>
Sun, 25 Jul 2021 04:31:16 +0000 (13:31 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 25 Jul 2021 04:31:16 +0000 (13:31 +0900)
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.

dispatchbot.sh
include/context.sh

index 0a0f8950bd8328296f3888f710292b8d86d88768..b4cf26fbc8d5a29d18ae25a86712228d32fbdbd7 100755 (executable)
@@ -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
index d542530b1cd11eca744d5f419779080854df01f8..90432d3717954bd8f3eda1767e19654c3a75cdd8 100644 (file)
@@ -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