Add post_upload_script - #22
Draft
djcrabhat wants to merge 6 commits into
Draft
Conversation
Adds an optional post_upload_script to the config, that when provided, executes a command, with {} replacement values.
3c7c8e7 was committed mid-edit and left send_file.cpp with character literals that don't compile ('' and a raw newline for '\r'/'\n', and ''' for '\''). Restore them so the shell escaping works as intended: single quotes on unix, carets with quotes dropped for cmd.exe. The rest of the review fixes (escaping the substituted values, decoding std::system's POSIX wait status, the destination picker's off-by-one) went in with that commit already. Also: - Document that placeholders should be left unquoted since values are escaped, and put the redirect first in the Windows example so a destination name ending in a digit isn't parsed by cmd.exe as a stream number. - Drop the unused protobuf::libprotoc link; only libprotobuf is needed for the generated pb.cc. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tooling that applied the previous fixes rewrote the file with LF, which churned all 252 lines against the CRLF the rest of the repo (and this file's own history) uses. Content is unchanged from e13e0b6. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The post-upload script code had accumulated in send_file.cpp, which is otherwise just the program's flow, and ExpandTemplate sat in config.cpp even though the only thing that expands templates is the script runner. Collect all three in one place: - New shell.h / shell.cpp holding ExpandTemplate, EscapeForShell and RunPostUploadScript, moved as-is. - send_file.cpp is back to do_error and main, with its include list restored to what it was before the feature plus shell.h. - config.h / config.cpp keep only the post_upload_script field and its parsing, dropping the <utility> and <algorithm> includes that were there for ExpandTemplate. - Name the script runner RunPostUploadScript to match the other two. No behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It came back in 96fb337 by accident - the file was staged wholesale rather than re-diffed - and CMake's generate step fails on it because the target isn'\''t exported. Nothing here uses protoc's compiler APIs, only the generated pb.cc, which needs libprotobuf alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reverts 3043616 and the same change in e13e0b6. The removal was a local workaround that was sitting uncommitted in the working tree when the review ran, and I should not have folded it into a commit. Whether this link stays is the maintainer call, so main goes back to what it was. Note that a fresh configure fails on this target with a current vcpkg; CI pins vcpkg at 5bf0c55, where it still exists. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
post_upload_scriptto execute a shell command after a successful file upload.Had the idea when I wanted to automate my stream overlay, I use
send_file.exeto map to my MSUs. The example shows writing to a .txt file the name of the matched definition.