Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ob-async doesn't support :var #60

Open
3 tasks done
dzfranklin opened this issue Nov 24, 2019 · 3 comments
Open
3 tasks done

ob-async doesn't support :var #60

dzfranklin opened this issue Nov 24, 2019 · 3 comments

Comments

@dzfranklin
Copy link

dzfranklin commented Nov 24, 2019

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

I can use #+NAME: and :var to pass the result of one block to another block even if the first block is :async

Actual Behavior

Even after the block finishes executing and the result is shown, #<process emacs> is stored under the name of the block. For example:


#+NAME: result-value
#+BEGIN_SRC shell :async
echo FooBar
#+END_SRC

#+RESULTS: result-value
: FooBar

#+BEGIN_SRC shell :var input_var=result-value
echo $input_var
#+END_SRC

#+RESULTS:
:results:
#<process emacs>
:end:

Steps to Reproduce

  1. Use #+NAME: result-value to store the result of an :async shell block's execution.
  2. Run the block and wait for execution to finish and the result to be displayed
  3. Pass that result to another shell block with :var input_var=result-value and write code to print the value of that variable in the block.
  4. Run the block and observe that the value passed is not the value of the first block's execution and instead #<process emacs> or possible #<process emacs <n>>

Troubleshooting Artifacts

troubleshooting.org and a direct link to the raw troubleshooting.org file that shows the results of the blocks.

Note

In the case of python (and possibly other languages) this breaks the code necessary to store the value. As a result, attempting to execute a block with a variable set by an async block will lead to a SyntaxError. I'm including this note because the first keywords I googled for related to this error, before I realized it was a broader issue.

  File "<stdin>", line 3
    input_var=#<process emacs>
                             ^
SyntaxError: invalid syntax
@stardiviner
Copy link
Contributor

This is interesting usage of ob-async. I used this :var in non-ob-async case. I guess this is not easy to implement.

@FelipeLema
Copy link

Whoever works on this, should also consider the :cache header variable.

I'm having some inconsistency using it and I'm currently trying to stabilize/understand.

@zhenwenc
Copy link

Adding to this as its related to the :var header arg, ob-async causes variables to be evaluated twice, for example:

#+BEGIN_SRC sh :var INPUT=(read-string "Input: ")
echo $INPUT
#+END_SRC

The input prompt will show twice, and the second input value will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants