Function makeSwingsetController make Swingset Controller ( kernelStorage ? , deviceEndowments ? , runtimeOptions ? ) : Promise < { debug : { addDeviceHook : ( ( deviceName : any , hookName : any , hook : any ) => void ) ; } ; injectQueuedUpgradeEvents : ( ( ) => void ) ; validateAndInstallBundle : ( ( bundle : EndoZipBase64Bundle , allegedBundleID ??: string ) => Promise < string > ) ; writeSlogObject : ( ( obj : any ) => void ) ; changeKernelOptions ( options : any ) : void ; deviceNameToID ( deviceName : any ) : undefined | string ; dump ( ) : { acceptanceQueue : any [] ; gcActions : any [] ; kernelTable : any [] ; log : string [] ; objects : ( undefined | string | number ) [] [] ; promises : ( { decider : undefined | string ; id : string ; policy : string ; queue : string [] ; refCount : number ; state : "unresolved" ; subscribers : string [] ; } | { data : SwingSetCapData ; id : string ; refCount : number ; state : "rejected" | "fulfilled" ; } ) [] ; reapQueue : any ; runQueue : any [] ; vatTables : { state : { transcript : [ number , TranscriptEntry ] [] ; } ; vatID : string ; } [] ; } ; getActivityhash ( ) : string ; getStats ( ) : {} ; getStatus ( ) : { activeVats : { id : string ; options : RecordedVatOptions ; } [] ; } ; kpRegisterInterest ( kpid : any ) : void ; kpResolution ( kpid : any , options : any ) : SwingSetCapData ; kpStatus ( kpid : any ) : | "rejected" | "fulfilled" | "unknown" | "unresolved" ; log ( str : any ) : void ; pinVatRoot ( vatName : any ) : string ; queueToVatObject ( target : any , method : string | symbol , args ?: unknown [] , resultPolicy ?: ResolutionPolicy ) : undefined | string ; queueToVatRoot ( vatName : string , method : string | symbol , args ?: unknown [] , resultPolicy ?: ResolutionPolicy ) : undefined | string ; reapAllVats ( ) : void ; run ( policy ?: RunPolicy ) : Promise < number > ; shutdown ( ) : Promise < void > ; step ( ) : Promise < 0 | 1 > ; terminateVat ( vatID : string , reasonCD : SwingSetCapData ) : void ; upgradeStaticVat ( vatName : any , shouldPauseFirst : any , bundleID : any , options ?: {} ) : undefined | string ; vatNameToID ( vatName : any ) : string ; verboseDebugMode ( flag : any ) : void ; } > Parameters kernelStorage : SwingStoreKernelStorage = ... deviceEndowments : Record < string , unknown > = {} runtimeOptions : { bundleHandler ?: BundleHandler ; debugPrefix ?: string ; debugVats ?: string [] ; env ?: Record < string , undefined | string > ; kernelBundle ?: Bundle ; overrideVatManagerOptions ?: unknown ; profileVats ?: string [] ; slogCallbacks ?: unknown ; slogSender ?: SlogSender ; spawn ?: { ( command : string , options ?: SpawnOptionsWithoutStdio ) : ChildProcessWithoutNullStreams ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > ) : ChildProcessByStdio < Writable , Readable , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > ) : ChildProcessByStdio < Writable , Readable , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > ) : ChildProcessByStdio < Writable , null , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > ) : ChildProcessByStdio < null , Readable , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > ) : ChildProcessByStdio < Writable , null , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > ) : ChildProcessByStdio < null , Readable , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > ) : ChildProcessByStdio < null , null , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > ) : ChildProcessByStdio < null , null , null > ; ( command : string , options : SpawnOptions ) : ChildProcess ; ( command : string , args ?: readonly string [] , options ?: SpawnOptionsWithoutStdio ) : ChildProcessWithoutNullStreams ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > ) : ChildProcessByStdio < Writable , Readable , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > ) : ChildProcessByStdio < Writable , Readable , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > ) : ChildProcessByStdio < Writable , null , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > ) : ChildProcessByStdio < null , Readable , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > ) : ChildProcessByStdio < Writable , null , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > ) : ChildProcessByStdio < null , Readable , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > ) : ChildProcessByStdio < null , null , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > ) : ChildProcessByStdio < null , null , null > ; ( command : string , args : readonly string [] , options : SpawnOptions ) : ChildProcess ; } ; testTrackDecref ?: unknown ; verbose ?: boolean ; warehousePolicy ?: VatWarehousePolicy ; xsnapBundleData ?: { getLockdownBundle : ( ( ) => Promise < Bundle > ) ; getLockdownBundleSHA256 : ( ( ) => Promise < string > ) ; getSupervisorBundle : ( ( ) => Promise < Bundle > ) ; getSupervisorBundleSHA256 : ( ( ) => Promise < string > ) ; } ; } = {} Optional
bundle Handler ?: BundleHandler Optional
debug Prefix ?: string Optional
debug Vats ?: string [] Optional
env ?: Record < string , undefined | string > Optional
kernel Bundle ?: Bundle Optional
override Vat Manager Options ?: unknown Optional
profile Vats ?: string [] Optional
slog Callbacks ?: unknown Optional
slog Sender ?: SlogSender Optional
spawn ?: { ( command : string , options ?: SpawnOptionsWithoutStdio ) : ChildProcessWithoutNullStreams ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > ) : ChildProcessByStdio < Writable , Readable , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > ) : ChildProcessByStdio < Writable , Readable , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > ) : ChildProcessByStdio < Writable , null , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > ) : ChildProcessByStdio < null , Readable , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > ) : ChildProcessByStdio < Writable , null , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > ) : ChildProcessByStdio < null , Readable , null > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > ) : ChildProcessByStdio < null , null , Readable > ; ( command : string , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > ) : ChildProcessByStdio < null , null , null > ; ( command : string , options : SpawnOptions ) : ChildProcess ; ( command : string , args ?: readonly string [] , options ?: SpawnOptionsWithoutStdio ) : ChildProcessWithoutNullStreams ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > ) : ChildProcessByStdio < Writable , Readable , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > ) : ChildProcessByStdio < Writable , Readable , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > ) : ChildProcessByStdio < Writable , null , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > ) : ChildProcessByStdio < null , Readable , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > ) : ChildProcessByStdio < Writable , null , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > ) : ChildProcessByStdio < null , Readable , null > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > ) : ChildProcessByStdio < null , null , Readable > ; ( command : string , args : readonly string [] , options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > ) : ChildProcessByStdio < null , null , null > ; ( command : string , args : readonly string [] , options : SpawnOptions ) : ChildProcess ; } ( command , options ? ) : ChildProcessWithoutNullStreams Parameters command : string Optional
options : SpawnOptionsWithoutStdio Returns ChildProcessWithoutNullStreams ( command , options ) : ChildProcessByStdio < Writable , Readable , Readable > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > Returns ChildProcessByStdio < Writable , Readable , Readable > ( command , options ) : ChildProcessByStdio < Writable , Readable , null > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > Returns ChildProcessByStdio < Writable , Readable , null > ( command , options ) : ChildProcessByStdio < Writable , null , Readable > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > Returns ChildProcessByStdio < Writable , null , Readable > ( command , options ) : ChildProcessByStdio < null , Readable , Readable > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > Returns ChildProcessByStdio < null , Readable , Readable > ( command , options ) : ChildProcessByStdio < Writable , null , null > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > Returns ChildProcessByStdio < Writable , null , null > ( command , options ) : ChildProcessByStdio < null , Readable , null > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > Returns ChildProcessByStdio < null , Readable , null > ( command , options ) : ChildProcessByStdio < null , null , Readable > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > Returns ChildProcessByStdio < null , null , Readable > ( command , options ) : ChildProcessByStdio < null , null , null > Parameters command : string options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > Returns ChildProcessByStdio < null , null , null > ( command , options ) : ChildProcess Parameters command : string options : SpawnOptions Returns ChildProcess ( command , args ? , options ? ) : ChildProcessWithoutNullStreams Parameters command : string Optional
args : readonly string [] Optional
options : SpawnOptionsWithoutStdio Returns ChildProcessWithoutNullStreams ( command , args , options ) : ChildProcessByStdio < Writable , Readable , Readable > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioPipe > Returns ChildProcessByStdio < Writable , Readable , Readable > ( command , args , options ) : ChildProcessByStdio < Writable , Readable , null > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioPipe , StdioPipe , StdioNull > Returns ChildProcessByStdio < Writable , Readable , null > ( command , args , options ) : ChildProcessByStdio < Writable , null , Readable > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioPipe > Returns ChildProcessByStdio < Writable , null , Readable > ( command , args , options ) : ChildProcessByStdio < null , Readable , Readable > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioPipe > Returns ChildProcessByStdio < null , Readable , Readable > ( command , args , options ) : ChildProcessByStdio < Writable , null , null > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioPipe , StdioNull , StdioNull > Returns ChildProcessByStdio < Writable , null , null > ( command , args , options ) : ChildProcessByStdio < null , Readable , null > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioNull , StdioPipe , StdioNull > Returns ChildProcessByStdio < null , Readable , null > ( command , args , options ) : ChildProcessByStdio < null , null , Readable > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioPipe > Returns ChildProcessByStdio < null , null , Readable > ( command , args , options ) : ChildProcessByStdio < null , null , null > Parameters command : string args : readonly string [] options : SpawnOptionsWithStdioTuple < StdioNull , StdioNull , StdioNull > Returns ChildProcessByStdio < null , null , null > ( command , args , options ) : ChildProcess Parameters command : string args : readonly string [] options : SpawnOptions Returns ChildProcess Optional
test Track Decref ?: unknown Optional
verbose ?: boolean Optional
xsnap Bundle Data ?: { getLockdownBundle : ( ( ) => Promise < Bundle > ) ; getLockdownBundleSHA256 : ( ( ) => Promise < string > ) ; getSupervisorBundle : ( ( ) => Promise < Bundle > ) ; getSupervisorBundleSHA256 : ( ( ) => Promise < string > ) ; } get Lockdown Bundle : ( ( ) => Promise < Bundle > ) ( ) : Promise < Bundle > Returns Promise < Bundle > get Lockdown BundleSHA256 : ( ( ) => Promise < string > ) ( ) : Promise < string > Returns Promise < string > get Supervisor Bundle : ( ( ) => Promise < Bundle > ) ( ) : Promise < Bundle > Returns Promise < Bundle > get Supervisor BundleSHA256 : ( ( ) => Promise < string > ) ( ) : Promise < string > Returns Promise < string > Returns Promise < { debug : { addDeviceHook : ( ( deviceName : any , hookName : any , hook : any ) => void ) ; } ; injectQueuedUpgradeEvents : ( ( ) => void ) ; validateAndInstallBundle : ( ( bundle : EndoZipBase64Bundle , allegedBundleID ??: string ) => Promise < string > ) ; writeSlogObject : ( ( obj : any ) => void ) ; changeKernelOptions ( options : any ) : void ; deviceNameToID ( deviceName : any ) : undefined | string ; dump ( ) : { acceptanceQueue : any [] ; gcActions : any [] ; kernelTable : any [] ; log : string [] ; objects : ( undefined | string | number ) [] [] ; promises : ( { decider : undefined | string ; id : string ; policy : string ; queue : string [] ; refCount : number ; state : "unresolved" ; subscribers : string [] ; } | { data : SwingSetCapData ; id : string ; refCount : number ; state : "rejected" | "fulfilled" ; } ) [] ; reapQueue : any ; runQueue : any [] ; vatTables : { state : { transcript : [ number , TranscriptEntry ] [] ; } ; vatID : string ; } [] ; } ; getActivityhash ( ) : string ; getStats ( ) : {} ; getStatus ( ) : { activeVats : { id : string ; options : RecordedVatOptions ; } [] ; } ; kpRegisterInterest ( kpid : any ) : void ; kpResolution ( kpid : any , options : any ) : SwingSetCapData ; kpStatus ( kpid : any ) : | "rejected" | "fulfilled" | "unknown" | "unresolved" ; log ( str : any ) : void ; pinVatRoot ( vatName : any ) : string ; queueToVatObject ( target : any , method : string | symbol , args ?: unknown [] , resultPolicy ?: ResolutionPolicy ) : undefined | string ; queueToVatRoot ( vatName : string , method : string | symbol , args ?: unknown [] , resultPolicy ?: ResolutionPolicy ) : undefined | string ; reapAllVats ( ) : void ; run ( policy ?: RunPolicy ) : Promise < number > ; shutdown ( ) : Promise < void > ; step ( ) : Promise < 0 | 1 > ; terminateVat ( vatID : string , reasonCD : SwingSetCapData ) : void ; upgradeStaticVat ( vatName : any , shouldPauseFirst : any , bundleID : any , options ?: {} ) : undefined | string ; vatNameToID ( vatName : any ) : string ; verboseDebugMode ( flag : any ) : void ; } >
The
child_process.spawn()
method spawns a new process using the givencommand
, with command-line arguments inargs
. If omitted,args
defaults to an empty array.If the
shell
option is enabled, do not pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution.A third argument may be used to specify additional options, with these defaults:
Use
cwd
to specify the working directory from which the process is spawned. If not given, the default is to inherit the current working directory. If given, but the path does not exist, the child process emits anENOENT
error and exits immediately.ENOENT
is also emitted when the command does not exist.Use
env
to specify environment variables that will be visible to the new process, the default isprocess.env
.undefined
values inenv
will be ignored.Example of running
ls -lh /usr
, capturingstdout
,stderr
, and the exit code:Example: A very elaborate way to run
ps ax | grep ssh
Example of checking for failed
spawn
:Certain platforms (macOS, Linux) will use the value of
argv[0]
for the process title while others (Windows, SunOS) will usecommand
.Node.js overwrites
argv[0]
withprocess.execPath
on startup, soprocess.argv[0]
in a Node.js child process will not match theargv0
parameter passed tospawn
from the parent. Retrieve it with theprocess.argv0
property instead.If the
signal
option is enabled, calling.abort()
on the correspondingAbortController
is similar to calling.kill()
on the child process except the error passed to the callback will be anAbortError
: