<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="305854" data-post-id="305854">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="alecnmk" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/alecnmk/120/20783_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  alecnmk
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><img src="https://forum.elixirforum.com/images/emoji/apple/wave.png?v=15" title=":wave:" class="emoji" alt=":wave:" loading="lazy" width="20" height="20"> 3 years later! spotted this post while dealing with some legacy code.</p>
<p>If you really need to restart a process that’s part of the app sup tree, say in the setup block of your test, you can do that with:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">:ok = Supervisor.terminate_child(My.Supervisor, My.Pipe)
{:ok, _} = Supervisor.restart_child(My.Supervisor, My.Pipe)
</code></pre>
<p>And in order to make it work you’d need to name your Supervisor in the application start, like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Supervisor.start_link(children, name: My.Supervisor)
</code></pre>
<p>Note: restarting child would use original child spec defined in your app. So if you’d like to override some options passed into a supervised module you’d need to not rely on actual options in the child spec, but on the configuration of your supervised module that’s pulled from the app configs. In the original example that topic started brought up that <code>My.Pipe</code> is getting started with empty options.</p>
<p>I saw that approach <a href="https://github.com/sasa1977/con_cache#testing-in-your-application" rel="noopener nofollow ugc">recommended by @sasajuric</a> a while back and I would suggest you do that <em>only</em> if you have no other way and you just need to get things done quick. Of course, most likely you wouldn’t like to have such test running async.</p>
<p>But the approach with <code>start_supervised</code> that <a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> and <a class="mention" href="/u/idi527" rel="nofollow">@idi527</a> pointed out above is what is probably an ideal way of doing things <img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305854" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/restarting-a-process/30686/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-305854" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305854"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>