Re: [code] Confused about Events

From: Robert Gieseke <rob.g.att.web.de>
Date: Sat, 03 Jan 2015 14:09:41 +0100

Hi,

Am 02/01/15 um 22:46 schrieb DrTebi:
> Thanks for the quick reply.
>
> I figured it out now, it works great!
>
> One last thing I would like to implement is the `exit_status` that
> os.execute returns--I cannot figure out how to act upon it. It
> *should* return 0 when everything went fine, but I always get a
> boolean value...
> I think the better solution would be to use io.popen, but that will
> get a bit more complicated.
>

Glad to hear that. `io.popen` would be an option, but it's probably
better to use Textadept's `spawn`[1] functionality:

Replacing os.execute with something like:
spawn(
  string.format('%s %q %q', sh_cmd, rst_path, html_path),
  nil, nil, nil,
  function (status)
    ui.statusbar_text = 'Exit code: '..status
  end
)

The last one is the exit callback and would be different from 0 if e.g.
rst2html couldn't be found.

Cheers,
Robert

[1] http://foicica.com/textadept/api.html#spawn

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 03 Jan 2015 - 08:09:41 EST

This archive was generated by hypermail 2.2.0 : Sun 04 Jan 2015 - 06:48:30 EST