Skip to content
Snippets Groups Projects
Commit 09640b7a authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Revert Fork Changes

parent 906295d2
No related branches found
No related tags found
No related merge requests found
...@@ -85,10 +85,9 @@ impl<'a> Fork<'a> { ...@@ -85,10 +85,9 @@ impl<'a> Fork<'a> {
drop(read); drop(read);
} }
// Execute the given closure within the child's shell, and stop the context's // Execute the given closure within the child's shell.
// background thread. NOTE: That last thing solves a memory leak.
let mut shell: Shell = unsafe { (self.shell as *const Shell).read() }; let mut shell: Shell = unsafe { (self.shell as *const Shell).read() };
shell.context.take().map(|mut c| c.history.commit_history()); // shell.context.take().map(|mut c| c.history.commit_history());
child_func(&mut shell); child_func(&mut shell);
// Reap the child, enabling the parent to get EOF from the read end of the pipe. // Reap the child, enabling the parent to get EOF from the read end of the pipe.
......
...@@ -30,7 +30,7 @@ pub(crate) fn fork_pipe( ...@@ -30,7 +30,7 @@ pub(crate) fn fork_pipe(
// Drop the context and it's background thread in the child. // Drop the context and it's background thread in the child.
// NOTE: Solves a memory leak. // NOTE: Solves a memory leak.
shell.context.take().map(|mut c| c.history.commit_history()); // shell.context.take().map(|mut c| c.history.commit_history());
// After execution of it's commands, exit with the last command's status. // After execution of it's commands, exit with the last command's status.
exit(pipe(shell, commands, false)); exit(pipe(shell, commands, false));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment