job spawn

For experimental.

Spawn a background job and retrieve its ID.

Command Type

built-in

Signature

> job spawn {flags} (closure)

Flags

  • --description, -d {string}: An optional description for this job.

Parameters

  • closure: The closure to run in another thread.

Input/output types:

input output
nothing int

Examples

Spawn a background job to do some time consuming work.

> job spawn { sleep 5sec; rm evidence.pdf }

Notes

Executes the provided closure in a background thread and registers this task in the background job table, which can be retrieved with job list.

This command returns the job id of the newly created job.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.