Skip to content

Commit

Permalink
ensure message pipe path exists before creating pipe
Browse files Browse the repository at this point in the history
- see #297 for the reported error.
  • Loading branch information
OneCDOnly committed Oct 1, 2024
1 parent 599e642 commit 42a234f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions support/sherpa-manager.source
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ CreatePaths()
MakePath "$r_reports_path" reports || return
MakePath "$r_qpkg_bu_path" 'QPKG backup' || return
MakePath "$r_qpkg_download_path" 'QPKG download' || return
MakePath "$r_qpkg_states_path" states || return

}

Expand Down Expand Up @@ -1741,10 +1742,18 @@ ProcAction()
OpenActionMsgPipe()
{

# Inputs: (global)
# $r_action_msg_pipe

# Outputs: (global)
# $action_msg_pipe_fd
# $backup_stdin_fd

# Create a message pipe, so action forks can send data back to parent.

[[ -p $r_action_msg_pipe ]] && rm -f "$r_action_msg_pipe" 2> /dev/null
[[ ! -p $r_action_msg_pipe ]] && mknod "$r_action_msg_pipe" p
[[ ! -d $($DIRNAME_CMD "$r_action_msg_pipe") ]] && mkdir -p "$($DIRNAME_CMD "$r_action_msg_pipe")"
[[ ! -p $r_action_msg_pipe ]] && $MKNOD_CMD "$r_action_msg_pipe" p

# Create a file descriptor to store original stdin FD.

Expand All @@ -1769,6 +1778,11 @@ OpenActionMsgPipe()
CloseActionMsgPipe()
{

# Inputs: (global)
# $action_msg_pipe_fd
# $backup_stdin_fd
# $r_action_msg_pipe

# Restore original file descriptors, and remove message pipe.

if [[ -n ${backup_stdin_fd:-} ]]; then
Expand Down Expand Up @@ -7395,8 +7409,6 @@ BuildQPKGsStates()

ShowAsProc 'QPKG states'

MakePath "$r_qpkg_states_path" states || return

# Faster to launch several concurrent loops async, than a single loop. Launch those requiring more processing-time first.

# This one should only be run when actioning 'installable' QPKGs.
Expand Down Expand Up @@ -12568,7 +12580,7 @@ ClearPath()
{

# Clear (empty) an existing directory, but don't delete the directory.
# Delete files in a relatively safe manner. Parent of directory MUST be specified to avoid an 'rm -rf /*' situation through empty args.
# Delete files in a relatively safe manner. Parent of directory MUST be specified to avoid an `rm -rf /*` situation because of empty args.

# Inputs: (local)
# $1 = full path to parent of directory name to clear.
Expand Down

0 comments on commit 42a234f

Please sign in to comment.