Updated What Happens When... (markdown)

Kevin Lange 2015-10-02 23:56:13 -07:00
parent d21234c174
commit 85f8204d45

@ -26,6 +26,8 @@ The compositor's event handler thread receives the display flip event and [appen
## `fetch http://www.toaruos.org`
The process for the `f` key repeats for all the other keys until we hit Enter and the shell's [call to `rline()`](https://github.com/klange/toaruos/blob/e195298e5ba99956ee05a1ce91c0024ea95321db/userspace/core/sh.c#L483) returns, our buffer now filled with "fetch http://www.toaruos.org". At this point, the shell needs to [parse the buffer](https://github.com/klange/toaruos/blob/e195298e5ba99956ee05a1ce91c0024ea95321db/userspace/core/sh.c#L526) to figure out what we want to do. The shell supports complex quoting, variables, and pipes, the last of which means forking off multiple child processes and linking their inputs and outputs appropriately. Luckily, we've entered a fairly simple command and all the shell needs to do is split it into two tokens (`fetch` and `http://www.toaruos.org`), [fork a child and run the command](https://github.com/klange/toaruos/blob/e195298e5ba99956ee05a1ce91c0024ea95321db/userspace/core/sh.c#L779).
[![](http://i.imgur.com/jnhNCk9m.png)](http://i.imgur.com/jnhNCk9.png)
## Forking and execing
_TODO: This section could use more details._