Migrate remaining footnote-style collection access in examples, public/structure, and ext/lib smokes to [key](base); teach link-index in structure pages and use bracket calls in the cafe journal example. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
596 B
Markdown
29 lines
596 B
Markdown
---
|
|
title: sys.exec capture=True returns stdout map
|
|
description: GAP-09 optional capture.
|
|
import sys:lib/sys.mq.md
|
|
import json:lib/json.mq.md
|
|
---
|
|
|
|
# main
|
|
|
|
**code = > sys.exec cmd="true"**
|
|
1. `code` == 0
|
|
> print text=exec-code-ok
|
|
2. *
|
|
> print text=exec-code-fail
|
|
|
|
**args = > json.parse text=["-c","printf hi-capture"]**
|
|
**out = > sys.exec cmd="sh" args=args capture=True**
|
|
**c = [code](out)**
|
|
**s = [stdout](out)**
|
|
1. `c` == 0
|
|
> print text=capture-code-ok
|
|
2. *
|
|
> print text=capture-code-fail
|
|
|
|
1. `s` == "hi-capture"
|
|
> print text=capture-stdout-ok
|
|
2. *
|
|
> print text=capture-stdout-fail
|