emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: suarezmiguelc@icloud.com
To: emacs-orgmode@gnu.org
Subject: Babel zip after exporting file
Date: Thu, 16 Mar 2023 23:39:13 +0100	[thread overview]
Message-ID: <F1F89CBE-80C9-467F-A871-D69191BCB3B1@icloud.com> (raw)

Hello Emacs org-mode community, I’m trying this example:

** index.js
:header-args: :tangle index.js :post-tangle (shell-command-to-string "zip index.js.zip index.js && rm index.js")

First endpoint example:

#+begin_src js
exports.handler = async (event, context) => {
  console.log('Received event:', JSON.stringify(event, null, 2));
  return {
    statusCode: 200,
    headers: {
      'Content-Type': 'application/json'
    body: JSON.stringify({
      message: 'Hello, world!'

What I want is to:
1. Tangle the index.js file
2. Zip it as index.js.zip
3. Delete the raw code index.js

The thing is that, the command inserted in :post-tangle is executed before the creation of the file, so it only works if the file already exists, so:
- First run, file doesn’t exist, only index.js is generated.
- Second run, zip file appears, index.js is intact since the rm index.js command ran but then index.js was generated again.

How should I debug this?

             reply	other threads:[~2023-03-16 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 22:39 suarezmiguelc [this message]
2023-03-17 12:41 ` Babel zip after exporting file Max Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F1F89CBE-80C9-467F-A871-D69191BCB3B1@icloud.com \
    --to=suarezmiguelc@icloud.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).