4 ms·
kona I use it as my shell.
by CUR10US 14y ago
kona
I use it as my shell.
- silentbicycle 14y agoBy which they mean Kona (https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona), an open-source implementation of a K-like language. Any commands in its repl that are prefixed with "\ " are sent as-is to system(3).
- deleted 14y ago[deleted]
- silentbicycle 14y ago"\ command" (e.g. "\ ls") works, you don't need to type exec. It passes the rest of the string to system: https://github.com/silentbicycle/kona/blob/master/c.c#L423 https://github.com/silentbicycle/kona/blob/master/c.c#L423 I'm one of the kona developers.
- CUR10US 14y agoHow to avoid forking?
- silentbicycle 14y agoI have a fork because I sent several pull requests back, before I got commit rights to the main repo (kevinlawler's).
- CUR10US 14y agoI meant fork(2). Maybe edit the source to optionally use execve?
- silentbicycle 14y agoOh, right. execve replaces the existing process with the invoked one, so I'm not sure that use case makes sense. Usually execve is used with fork, too. If you're concerned with Windows portability, mmap(2) is a bigger problem. Otherwise, not sure why you're asking...?
- CUR10US 14y agoSometimes I don't want to fork, e.g., if there's nothing waiting for input, e.g., the last program in a pipe. prog |prog |exec prog The usual way to do this is to put it in a shell script, then run the shell script. Though it would be nice in some instances, you can't run exec from a shell prompt or you'll exit the shell. I was thinking that if I'm in the kona console, executed from a parent shell, then I could type exec from the console and run programs without forking, because it's not going to cause kona to exit. Wishful thinking. To stop forking, you would have to add an option to call execve() instead of system() in the kona source.
- silentbicycle 14y agoOh. That wouldn't need much changed to work. I probably won't get to it for a while, but a patch/pull request would be welcome.