According to the racket reference,
When provided as a port, stdout is used for the launched process’s standard output, stdin is used for the process’s standard input, and stderr is used for the process’s standard error. All provided ports must be file-stream ports. Any of the ports can be #f, in which case a system pipe is created and returned by subprocess.The stderr argument can be 'stdout, in which case the same file-stream port or system pipe that is supplied as standard output is also used for standard error.
So I typed these codes in the REPL and got errors due to the problem of permission:
Welcome to Racket v8.8.0.8 [cs].
> (define-values (sp1 stdout1 stdin1 stderr1) (subprocess (current-output-port) (current-input-port) #f #f "racket"))
> (define-values (sp2 stdout2 stdin2 stderr2) (subprocess (current-output-port) (current-input-port) (current-error-port) #f "racket"))
> exec failed (权限不够; errno=13)
> (define-values (sp3 stdout3 stdin3 stderr3) (subprocess (current-output-port) (current-input-port) 'stdout #f "racket"))
> exec failed (权限不够; errno=13)
Could someone tell me what happened here? And what can I do to set the stderr of a subprocess to the (current-error-port)
?