>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

task: task

executing tasks with optional timeout or I/O

TASKS WITHOUT I/O

  fork 'notepad.exe'           NB. run notepad, no wait, no I/O
  5000 fork 'notepad.exe'      NB. run notepad, wait 5 sec, no I/O
  _1 fork 'notepad.exe'        NB. run notepad, until closed, no I/O
  5000 fork 'cmd /k dir'  NB. show dir in cmd window for 5 sec and close
  _1 fork 'cmd /k dir'    NB. show dir in cmd window until user closes it
TASKS WITH I/O
  spawn 'net users'                    NB. get stdout from process
  '+/i.3 4'spawn'jconsole'             NB. call process with I/O
  12 15 18 21
SHELL COMMANDS (WITH I/O)
  shell'echo.|time'                    NB. get result of shell command
The current time is:  8:04:13.09
Enter the new time:
  (shell'dir /b')shell'find ".dll"'    NB. get all DDL names by piping
j.dll
jregexp.dll
NOTE: the implementation uses C-type structures by the original Method of Named Fields

Script developed by Oleg Kobchenko.

Name Type Description
fork verb run task and optionally wait for completion
shell verb [monad] get stdout of shell command
shell verb [dyad] send stdin and get stdout of shell command
spawn verb [monad] get stdout of executed task
spawn verb [dyad] send stdin and get stdout of task

fork

run task and optionally wait for completion

form: [timeout=0] fork cmdline

  timeout: 0 no wait, _1 infinite, >0 timeout
  cmdline: 'shortcmd arg1 arg2 ...'
  cmdline: '"command with space" arg1 ...'

e.g. fork 'notepad.exe'

shell

[monad] get stdout of shell command

  e.g. shell 'dir /b/s'

shell

[dyad] send stdin and get stdout of shell command

  e.g. (shell 'dir /b/s') shell 'find ".dll"'

spawn

[monad] get stdout of executed task

form:  stdout=. spawn cmdline

  stdout: _1 fail, '' or stdout stream value if success
  cmdline: 'shortcmd arg1 arg2 ...'
  cmdline: '"command with space" arg1 ...'

e.g. spawn 'net users'

spawn

[dyad] send stdin and get stdout of task

form: stdout=. [stdin=''] spawn cmdline

  stdin: input to stream as stdin, '' no input

e.g. 'i.3 4'spawn'jconsole'


>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User