# \`call\` asynchronously?

**URL:** <https://revolt.metaeducation.com/forum/t/call-asynchronously/1509>\
**Category:** Usage\
**Created:** [February 15, 2021, 5:19pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509 "2021-02-15T17:19:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![okram](https://revolt.metaeducation.com/forum/letter_avatar_proxy/v4/letter/o/b9bd4f/32.png) [@okram](https://revolt.metaeducation.com/forum/u/okram)\
**Post date:** [February 15, 2021, 5:19pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/1 "2021-02-15T17:19:03Z")

</div>

On Atronix R3 when I run `call "zathura"` the program runs asynchronously. When I do the same in Revolt it waits for the program to terminate. The available refinements do not seem to help.

---

<div class="post-metadata">

**Author:** ![okram](https://revolt.metaeducation.com/forum/letter_avatar_proxy/v4/letter/o/b9bd4f/32.png) [@okram](https://revolt.metaeducation.com/forum/u/okram)\
**Post date:** [February 15, 2021, 5:49pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/2 "2021-02-15T17:49:11Z")

</div>

As a work-around I now use `call/shell` with a `&` added to the end of the command line.

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [February 15, 2021, 7:40pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/3 "2021-02-15T19:40:06Z")

</div>

> [@okram](#):
>
> On Atronix R3 when I run `call "zathura"` the program runs asynchronously. When I do the same in Revolt it waits for the program to terminate.

CALL is a specialization of a more basic `CALL*`, which forces it to wait:

[/extensions/process/ext-process-init.reb#L58](https://github.com/metaeducation/ren-c/blob/5d54daea5979911b00455a98fbcfa28c15af6951/extensions/process/ext-process-init.reb#L58)

So you can just use `CALL*` _(which is itself a layer that does some usermode preprocessing over parameters before they get to `CALL-INTERNAL*`. For anything not performance-criticial, it's best to avoid trying to write it in C where it is harder to change, so the C code tries to keep it to the bare minimum of what's needed to expose the system functions)_.

There's actually some kind of interesting code going on here, glossing the command line differences between Windows and POSIX. Windows operates on the basis of one big command line string, while UNIX expects an array of individual elements.

So if you're on POSIX and call with a single string, the native code hooked to exec() and pipe() will call out to the usermode [parse-command-to-argv\*](https://github.com/metaeducation/ren-c/blob/5d54daea5979911b00455a98fbcfa28c15af6951/extensions/process/ext-process-init.reb#L60)

And if you're on Windows and call with a block, the native code hooked to CreateProcess will call out to the usermode [argv-block-to-command\*](https://github.com/metaeducation/ren-c/blob/5d54daea5979911b00455a98fbcfa28c15af6951/extensions/process/ext-process-init.reb#L60)

I've written about this and I think it's neat.

> [@Open Your Mind: A COLLECT in PARSE Meditation](https://revolt.metaeducation.com/forum/t/open-your-mind-a-collect-in-parse-meditation/1100):
>
> The first time I used CALL, I griped that it was somewhat unusable (with a complaint that basically everyone else who tried it had, my complaint was far from unique). I would have thought that if I said call {r3 --do "print {Hello}"} that it would "do what I meant". Instead, what it did was try and find an executable file whose name (including spaces and quotes) was r3 --do "print {Hello}", and run it. As crazy as that interpretation may seem on the surface, it actually came from a desire to …

---

<div class="post-metadata">

**Author:** ![okram](https://revolt.metaeducation.com/forum/letter_avatar_proxy/v4/letter/o/b9bd4f/32.png) [@okram](https://revolt.metaeducation.com/forum/u/okram)\
**Post date:** [February 16, 2021, 1:53pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/4 "2021-02-16T13:53:37Z")

</div>

Thanks! I had found that other post of yours, but it didn't seem to answer my question.

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [February 16, 2021, 1:57pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/5 "2021-02-16T13:57:11Z")

</div>

> [@okram](#):
>
> I had found that other post of yours

Glad you're still around and looking at this mess. It _is_ a mess, but... it's in service of an experiment. A different way of attacking programming problems.

It's definitely different. Though...

![](http://28.media.tumblr.com/tumblr_labmz1v2QU1qd0a5no1_500.jpg)

---

<div class="post-metadata">

**Author:** ![okram](https://revolt.metaeducation.com/forum/letter_avatar_proxy/v4/letter/o/b9bd4f/32.png) [@okram](https://revolt.metaeducation.com/forum/u/okram)\
**Post date:** [February 16, 2021, 2:00pm UTC](https://revolt.metaeducation.com/forum/t/call-asynchronously/1509/6 "2021-02-16T14:00:15Z")

</div>

I'm still around. Other things are taking up a lot of time...
