<commit_before>#!/usr/bin/env bash

work_dir="$(pwd)"
tools_dir="$(cd "$(dirname "$0")" && pwd)"
source "$tools_dir/common.sh"
logfile="$log_dir/process_queued_command.log"

lock_key=''

queue_dir="$status_dir/command_queue"
mkdir -p "$queue_dir"

while unlock "$lock_key" && read path
do
  command="$(cat "$path")"
  id="$(basename "$path" | cut -d '.' -f 2)"

  lock_key="queued_command.$id"
  try_lock_until_success "$lock_key"

  log '=============================================================='
  log "Processing queued command: \"$command\""

  output="$("$tweet_sh" $command 2>&1)"
  if [ $? = 0 ]
  then
    log "Successfully processed: \"$command\""
    rm "$processed_path"
    exit 0 # process only one queue!<commit_msg>Give blank string to stdin to prevent reading of rest queued command paths<commit_after>#!/usr/bin/env bash

work_dir="$(pwd)"
tools_dir="$(cd "$(dirname "$0")" && pwd)"
source "$tools_dir/common.sh"
logfile="$log_dir/process_queued_command.log"

lock_key=''

queue_dir="$status_dir/command_queue"
mkdir -p "$queue_dir"

while unlock "$lock_key" && read path
do
  command="$(cat "$path")"
  id="$(basename "$path" | cut -d '.' -f 2)"

  lock_key="queued_command.$id"
  try_lock_until_success "$lock_key"

  log '=============================================================='
  log "Processing queued command: \"$command\""

  output="$(echo '' | "$tweet_sh" $command 2>&1)"
  if [ $? = 0 ]
  then
    log "Successfully processed: \"$command\""
    rm "$processed_path"
    exit 0 # process only one queue!
{'fraction_non_alphanumeric': 0.2511356262167424, 'fraction_numerical': 0.007787151200519144, 'mean_word_length': 5.070866141732283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '87826', 'n_tokens_mistral': 555, 'n_tokens_neox': 514, 'n_words': 124}