MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_copy_binary_to_target

Function cbm_copy_binary_to_target

src/cli/cli.c:1175–1197  ·  view source on GitHub ↗

Copy the running binary transactionally. The command-level install path * stages before draining the cohort; this public helper preserves the old * focused regression surface for independent callers. */

Source from the content-addressed store, hash-verified

1173 * stages before draining the cohort; this public helper preserves the old
1174 * focused regression surface for independent callers. */
1175int cbm_copy_binary_to_target(const char *src, const char *dst) {
1176 if (!src || !dst) {
1177 return CLI_ERR;
1178 }
1179 if (cbm_same_file(src, dst)) {
1180 return CLI_OK;
1181 }
1182 cbm_activation_transaction_t *transaction = NULL;
1183 cbm_activation_transaction_status_t status =
1184 cbm_activation_transaction_stage_file(dst, src, &transaction);
1185 cli_binary_validator_t validator;
1186 if (status != CBM_ACTIVATION_TRANSACTION_OK || !transaction ||
1187 !cli_activation_transaction_expected_build(transaction, &validator)) {
1188 (void)cli_activation_transaction_abort(&transaction);
1189 return CLI_ERR;
1190 }
1191 if (cli_activation_transaction_commit_validated(transaction, &validator, CLI_OCTAL_PERM) !=
1192 CLI_OK) {
1193 (void)cli_activation_transaction_abort(&transaction);
1194 return CLI_ERR;
1195 }
1196 return cli_activation_transaction_finalize_close(&transaction);
1197}
1198
1199/* Replace a binary transactionally, retaining the old target until the exact
1200 * staged bytes have been published and validated. */

Callers 1

test_cli.cFile · 0.85

Tested by

no test coverage detected