Re: [code] [textadept] output from spawn on Windows?

From: Mateusz Czaplinski <>
Date: Tue, 10 Feb 2015 00:44:20 +0100

Hmh, argh, right, `..` not `+`, dumb error... too long without Lua... but,
that doesn't really solve the rest, unfortunately....

It starts to smell somewhat fishy to me now: I've just tried Ctrl-E with:

pp=spawn('git --version',_USERHOME,ui.print,ui.print,ui.print) pp:wait()

and the output I get is:

git version 1.9.4.msysgit.2


so, the callbacks are apparently still called async, long after the :wait()
has finished. So that's probably why I wasn't able to capture anything?
That doesn't seem to give me much hope as to processing the command's
output and doing something useful afterwards in a synchronous way...


On Mon, Feb 9, 2015 at 3:26 PM, Mitchell <> wrote:

> Hi Mateusz,
> On Sat, 7 Feb 2015, Mateusz Czaplinski wrote:
> Hi,
>> I tried to use spawn() on Windows, and retrieve some output from it, but
>> all seems empty. Is it supposed to work on Windows (7, x64)? Maybe I'm
>> using it wrong - could you please maybe show me a full command that's
>> expected to work to capture output? (To be more precise: the command
>> seemed
>> to run successfully in itself, only I couldn't capture the output.) I
>> tried
>> something like below:
>> local pout, perr, pcode = '', '', nil
>> local proc = spawn(my_command, my_workdir,
>> function(out) pout = pout + out end,
>> function(out) perr = perr + out end,
>> function(code) pcode = code end)
>> local s, errc, err = proc:read '*a'
>> if s==nil then
>> ui.print('error: '..errc..' '..err)
>> end
>> ui.print('s=', s)
>> ui.print('pout=', pout)
>> ui.print('perr=', perr)
>> ui.print('pcode=', pcode)
>> In the [Message Buffere] they all show empty, and pcode shows nil.
>> Also tried to add proc:wait() before or after the read(), but doesn't seem
>> to help either.
> You are using `proc:read()`, so the stdout and stderr callbacks will never
> populate `pout` and `perr` (it wouldn't work anyway since you should be
> using the concatenation operator `..` instead of numeric addition `+`). Try
> using `proc:wait()` without any call to `proc:read()`.
> I've entered the following command into the command entry and gotten the
> proper output in the message buffer:
> spawn('ruby -v', nil, ui.print, ui.print, ui.print)
> (No `wait()`, `read()`, etc. I just let the asynchronous process do its
> thing.)
> Cheers,
> Mitchell
> --
> You are subscribed to
> To change subscription settings, send an e-mail to
> To unsubscribe, send an e-mail to

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 09 Feb 2015 - 18:44:20 EST

This archive was generated by hypermail 2.2.0 : Tue 10 Feb 2015 - 06:46:07 EST