<commit_before>require 'tupelo/app'

Tupelo.application do |app|
  expected = [[1], [2], [3]]

  app.local do |client|
    client.write *expected
  end
      
  child_pid = app.child do |client|
    # Test that tuples written before this client started are readable.
    a = client.read_all [Integer]
    client.write result: a
    sleep 0.1
  end

  # Normally we would wait using tuples, but in this case we want more
  # isolation in the test case, so we wait in terms of the PID.
  Process.waitpid child_pid<commit_msg>use write_wait instead of write and sleep<commit_after>require 'tupelo/app'

Tupelo.application do |app|
  expected = [[1], [2], [3]]

  app.local do |client|
    client.write *expected
  end
      
  child_pid = app.child do |client|
    # Test that tuples written before this client started are readable.
    a = client.read_all [Integer]
    client.write_wait result: a
  end

  # Normally we would wait using tuples, but in this case we want more
  # isolation in the test case, so we wait in terms of the PID.
  Process.waitpid child_pid
{'fraction_non_alphanumeric': 0.08169014084507042, 'fraction_numerical': 0.007511737089201878, 'mean_word_length': 3.1640625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7031619', 'n_tokens_mistral': 342, 'n_tokens_neox': 332, 'n_words': 135}