On Mon, Jun 11, 2012 at 4:47 PM, Roland Mainz <[email protected]> wrote: > On Mon, Jun 11, 2012 at 4:09 PM, Irek Szczesniak <[email protected]> > wrote: >> On Mon, Jun 11, 2012 at 4:03 PM, David Korn <[email protected]> wrote: >>> cc: [email protected] >>> Subject: Re: [ast-developers] libshell C API to begin subshell? >>> -------- >>>> >>>> Is there any public C API to begin a subshell? I'd like to create a >>>> subshell and run several commands through sh_run() and then let either >>>> end the subshell through a sh_run() executing exit() or by providing >>>> another C API call to end it. >>>> >>>> Irek >>> >>> Not directly, but after calling sh_init(), if you call >>> exitval = sh_trap("(command...)",0) >>> it should run command in a subshell. >> >> That doesn't help in our case because sh_trap() requires that the >> whole command chain must be known and available before calling it. But >> we want to run multiple commands in a subshell and stay in that >> subshell between sh_run() calls. The number and arguments to sh_run() >> may vary depending on the results we get between the calls. > > Does it help if you could use something like |sh_trap("( cmd1 )", ...) > ... sh_trap("( cmd2 )", ...) ... sh_trap("( cmd3 )", ...) ...| ?
No, this does not work for our project. We need to enter a subshell and stay there, issue commands from C code via sh_run() and sh_trap() from C code, with C code being executed between sh_run()/sh_trap() calls, and leave the subshell. Or even enter another subshell. > Otherwise we'll need a new API in libshell (well, I could see some > usage for it). I do see some usage for this, too. Irek _______________________________________________ ast-developers mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-developers
