unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* spawn call
@ 2014-04-26 18:52 Max
  2014-04-26 21:15 ` Chris Vine
  2014-04-27  8:08 ` Chaos Eternal
  0 siblings, 2 replies; 8+ messages in thread
From: Max @ 2014-04-26 18:52 UTC (permalink / raw)
  To: guile-user

Hi.

I'm looking for a way to "fire and forget" external program from Guile: something
similar to spawnOnce call in Haskell.

I've tried to look through http://www.gnu.org/software/guile/manual/guile.html and ML
archive but only found "system* arg1 arg2 …" which judging from description uses
waitpid. I need some function which does not wait for spawned program to finish but
returns immediately indicating whether it manage to start given program or not - the
spawned program might run forever for example.

Where should I look for it? Some library perhaps? Some usage examples?

cheers,
Max.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-26 18:52 spawn call Max
@ 2014-04-26 21:15 ` Chris Vine
  2014-04-27  9:10   ` Max
  2014-04-27  8:08 ` Chaos Eternal
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Vine @ 2014-04-26 21:15 UTC (permalink / raw)
  To: guile-user

On Sat, 26 Apr 2014 20:52:55 +0200
Max <maxim.suraev@campus.tu-berlin.de> wrote:
> Hi.
> 
> I'm looking for a way to "fire and forget" external program from
> Guile: something similar to spawnOnce call in Haskell.
> 
> I've tried to look through
> http://www.gnu.org/software/guile/manual/guile.html and ML archive
> but only found "system* arg1 arg2 …" which judging from description
> uses waitpid. I need some function which does not wait for spawned
> program to finish but returns immediately indicating whether it
> manage to start given program or not - the spawned program might run
> forever for example.
> 
> Where should I look for it? Some library perhaps? Some usage examples?

guile-lib (not to be confused with guile itself) has some process
starting support in the (os process) module.  run-with-pipe may be what
you are looking for, although there are others.

Chris



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-26 18:52 spawn call Max
  2014-04-26 21:15 ` Chris Vine
@ 2014-04-27  8:08 ` Chaos Eternal
  2014-04-27  9:21   ` Max
  1 sibling, 1 reply; 8+ messages in thread
From: Chaos Eternal @ 2014-04-27  8:08 UTC (permalink / raw)
  To: guile-user

why not use guile-scsh? guile-scsh is a port of scsh (scheme shell) to guile.
guile-scsh can be used to do most shell script's task .

guile-scsh provides a lot of syntaxes and procs for use with os processes.
for example:
run
run/port
run/file
run/collecting

check it out here:
https://gitorious.org/guile-scsh

On Sun, Apr 27, 2014 at 2:52 AM, Max <maxim.suraev@campus.tu-berlin.de> wrote:
> Hi.
>
> I'm looking for a way to "fire and forget" external program from Guile: something
> similar to spawnOnce call in Haskell.
>
> I've tried to look through http://www.gnu.org/software/guile/manual/guile.html and ML
> archive but only found "system* arg1 arg2 …" which judging from description uses
> waitpid. I need some function which does not wait for spawned program to finish but
> returns immediately indicating whether it manage to start given program or not - the
> spawned program might run forever for example.
>
> Where should I look for it? Some library perhaps? Some usage examples?
>
> cheers,
> Max.
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-26 21:15 ` Chris Vine
@ 2014-04-27  9:10   ` Max
  2014-04-27  9:32     ` Max
  0 siblings, 1 reply; 8+ messages in thread
From: Max @ 2014-04-27  9:10 UTC (permalink / raw)
  To: guile-user

26.04.2014 23:15, Chris Vine пишет:
>
> guile-lib (not to be confused with guile itself) has some process
> starting support in the (os process) module.  run-with-pipe may be what
> you are looking for, although there are others.

Thank you, *|run-concurrently from
http://www.nongnu.org/guile-lib/doc/ref/os.process/ is what I need: I do not plan to
communicate with spawned process via pipes.

The only unclear thing - is there a way to set environment variable(s) for the
spawned process?
|*

cheers,
Max.

>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-27  8:08 ` Chaos Eternal
@ 2014-04-27  9:21   ` Max
  2014-04-28 15:46     ` Chaos Eternal
  0 siblings, 1 reply; 8+ messages in thread
From: Max @ 2014-04-27  9:21 UTC (permalink / raw)
  To: guile-user

Thanks but the documentation seems very limited. Also I really prefer GPL code over
BSD/MIT/whatever proprietary-friendly so as long some free (as in Freedom, doh!
English is such a limited language :) alternatives exists I'll always choose those.

27.04.2014 10:08, Chaos Eternal пишет:
> why not use guile-scsh? guile-scsh is a port of scsh (scheme shell) to guile.
> guile-scsh can be used to do most shell script's task .
>
> guile-scsh provides a lot of syntaxes and procs for use with os processes.
> for example:
> run
> run/port
> run/file
> run/collecting
>
> check it out here:
> https://gitorious.org/guile-scsh
>
> On Sun, Apr 27, 2014 at 2:52 AM, Max <maxim.suraev@campus.tu-berlin.de> wrote:
>> Hi.
>>
>> I'm looking for a way to "fire and forget" external program from Guile: something
>> similar to spawnOnce call in Haskell.
>>
>> I've tried to look through http://www.gnu.org/software/guile/manual/guile.html and ML
>> archive but only found "system* arg1 arg2 …" which judging from description uses
>> waitpid. I need some function which does not wait for spawned program to finish but
>> returns immediately indicating whether it manage to start given program or not - the
>> spawned program might run forever for example.
>>
>> Where should I look for it? Some library perhaps? Some usage examples?
>>
>> cheers,
>> Max.
>>
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-27  9:10   ` Max
@ 2014-04-27  9:32     ` Max
  2014-04-30 17:42       ` Max
  0 siblings, 1 reply; 8+ messages in thread
From: Max @ 2014-04-27  9:32 UTC (permalink / raw)
  To: guile-user

Oh, and another thing - how to actually use this library? I mean I've found API
reference, but what shall I write into (use-modules ...) ?

cheers,
Max.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-27  9:21   ` Max
@ 2014-04-28 15:46     ` Chaos Eternal
  0 siblings, 0 replies; 8+ messages in thread
From: Chaos Eternal @ 2014-04-28 15:46 UTC (permalink / raw)
  To: guile-user

Really, the license is bsd-style. thank you for point it out.

For usage, just (use-modules (scsh scsh)) and then you can (run (ls))

And this chapter of scsh
http://scsh.net/docu/html/man-Z-H-3.html#node_chap_2 is suitable for
guile-scsh.

i have a complex script for managing kvm virtual machines,
https://code.google.com/p/vmscript/source/browse/trunk/bin/createvm.scm

On Sun, Apr 27, 2014 at 5:21 PM, Max <maxim.suraev@campus.tu-berlin.de> wrote:
> Thanks but the documentation seems very limited. Also I really prefer GPL code over
> BSD/MIT/whatever proprietary-friendly so as long some free (as in Freedom, doh!
> English is such a limited language :) alternatives exists I'll always choose those.
>
> 27.04.2014 10:08, Chaos Eternal пишет:
>> why not use guile-scsh? guile-scsh is a port of scsh (scheme shell) to guile.
>> guile-scsh can be used to do most shell script's task .
>>
>> guile-scsh provides a lot of syntaxes and procs for use with os processes.
>> for example:
>> run
>> run/port
>> run/file
>> run/collecting
>>
>> check it out here:
>> https://gitorious.org/guile-scsh
>>
>> On Sun, Apr 27, 2014 at 2:52 AM, Max <maxim.suraev@campus.tu-berlin.de> wrote:
>>> Hi.
>>>
>>> I'm looking for a way to "fire and forget" external program from Guile: something
>>> similar to spawnOnce call in Haskell.
>>>
>>> I've tried to look through http://www.gnu.org/software/guile/manual/guile.html and ML
>>> archive but only found "system* arg1 arg2 …" which judging from description uses
>>> waitpid. I need some function which does not wait for spawned program to finish but
>>> returns immediately indicating whether it manage to start given program or not - the
>>> spawned program might run forever for example.
>>>
>>> Where should I look for it? Some library perhaps? Some usage examples?
>>>
>>> cheers,
>>> Max.
>>>
>>
>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: spawn call
  2014-04-27  9:32     ` Max
@ 2014-04-30 17:42       ` Max
  0 siblings, 0 replies; 8+ messages in thread
From: Max @ 2014-04-30 17:42 UTC (permalink / raw)
  To: guile-user

Ok, I've got to use each module separately:

for example
(use-modules (os process))
...
(run-concurrently "systemctl")

Unfortunately there seems to be no way to change environment variables for the
process you run this way - at least there are no such parameters in the function :(

cheers,
Max.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-30 17:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-26 18:52 spawn call Max
2014-04-26 21:15 ` Chris Vine
2014-04-27  9:10   ` Max
2014-04-27  9:32     ` Max
2014-04-30 17:42       ` Max
2014-04-27  8:08 ` Chaos Eternal
2014-04-27  9:21   ` Max
2014-04-28 15:46     ` Chaos Eternal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).