Hacker News new | past | comments | ask | show | jobs | submit login

[deleted]



"\ 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

I'm one of the kona developers.


How to avoid forking?


I have a fork because I sent several pull requests back, before I got commit rights to the main repo (kevinlawler's).


I meant fork(2). Maybe edit the source to optionally use execve?


Oh, 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...?


Sometimes 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.


Oh. 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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: