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

feat: provide store opt #849

Merged
merged 2 commits into from
Jun 18, 2024
Merged

feat: provide store opt #849

merged 2 commits into from
Jun 18, 2024

Conversation

antongolub
Copy link
Contributor

@antongolub antongolub commented Jun 18, 2024

closes #650
relates #675

const getFixedSizeArray = (size) => {
  const arr = []
  return new Proxy(arr, {
    get: (target, prop) =>
      prop === 'push' && arr.length >= size
        ? () => {}
        : target[prop],
  })
}
const store = {
  stdout: getFixedSizeArray(1),
  stderr: getFixedSizeArray(1),
  stdall: getFixedSizeArray(0),
}

const p = await $({ store })`echo foo`

p.stdout.trim() //  'foo'
p.toString()    // ''
  • Tests pass

@antonmedv antonmedv merged commit ac2bc54 into google:main Jun 18, 2024
21 checks passed
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

Successfully merging this pull request may close these issues.

Long-running processes crash with "Invalid string length"
2 participants