You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improved script cleanup mechanism in macOS installer
Replaced exec with direct command execution
Added self-cleanup functionality to temp script
Diagram Walkthrough
flowchart LR
A["Original Script"] --> B["Execute Agent"]
B --> C["Background Cleanup"]
D["Updated Script"] --> E["Execute Agent"]
E --> F["Self Cleanup"]
A -.-> D
C -.-> F
Loading
File Walkthrough
Relevant files
Enhancement
build-installers.yml
Enhanced script cleanup in macOS installer
.github/workflows/build-installers.yml
Replaced exec with direct command execution for sounddocs-capture-agent
Added self-cleanup command rm -f "$0" to temp script
Removed background cleanup process with sleep delay
The added command uses a quoted literal "APP_RESOURCES_PATH/sounddocs-capture-agent". Ensure the placeholder replacement via sed applies to this line in the generated temp script and that quoting does not prevent correct path expansion or executable resolution.
"APP_RESOURCES_PATH/sounddocs-capture-agent"# Clean up this temp script when the agent exitsrm -f "$0"TERM_EOF
Replacing exec with a normal invocation changes signal handling and parent process lifecycle. Validate that Terminal session termination and Ctrl+C behavior still propagate correctly to the agent and that the cleanup runs reliably.
"APP_RESOURCES_PATH/sounddocs-capture-agent"# Clean up this temp script when the agent exitsrm -f "$0"TERM_EOF
Using rm -f "$0" depends on how the temp script is invoked; if $0 is a symlink or if the shell sources the script, removal may fail or be unsafe. Confirm that "$TEMP_SCRIPT" matches $0 and that the file is writable/removable in all install contexts.
# Clean up this temp script when the agent exitsrm -f "$0"TERM_EOF
Use trap 'rm -f "$0"' EXIT to ensure the temporary script is always cleaned up upon exit, even in case of errors. This makes the cleanup mechanism more robust.
#!/bin/bash
+# Ensure this script cleans itself up on exit+trap 'rm -f "$0"' EXIT+
echo "=================================================="
echo "📊 Agent status and logs will appear below."
echo " Press Ctrl+C to stop the agent."
echo "=================================================="
echo ""
# Run the actual agent executable
"APP_RESOURCES_PATH/sounddocs-capture-agent"
-# Clean up this temp script when the agent exits-rm -f "$0"-
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a potential failure case where the temporary script is not cleaned up and proposes using trap, which is a more robust solution for ensuring cleanup.
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
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.
PR Type
Enhancement
Description
Improved script cleanup mechanism in macOS installer
Replaced exec with direct command execution
Added self-cleanup functionality to temp script
Diagram Walkthrough
File Walkthrough
build-installers.yml
Enhanced script cleanup in macOS installer.github/workflows/build-installers.yml
execwith direct command execution forsounddocs-capture-agent
rm -f "$0"to temp script