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

fix: fixed incorrect wrap for process's stdio container #317

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sssooonnnggg
Copy link

@sssooonnnggg sssooonnnggg commented Oct 16, 2024

The stdio api of the process should ensure the calling order.

According to libuv's documentation and test cases, where stdio[0] is designated as stdin, stdio[1] as stdout, and stdio[2] as stderr.

When specifying stdin for the child process as stdin_pipe, stdout to a custom file, and stderr as stderr_pipe:

process_handle.stdio(stdin_pipe, flag)
process_handle.stdio(stdout_file_handle, flag)
process_handle.stdio(stderr_pipe, flag)

The previous uvw implementation incorrectly concatenates it as follows because it used two vectors seperately:

stdio[0] = stdout_file_handle
stdio[1] = stdin_pipe
stdio[2] = stderr_pipe

This is not the correct behaviour

This PR try to fix this.😊

Libuv spawn examples: https://github.com/libuv/libuv/blob/v1.x/test/test-spawn.c

@sssooonnnggg
Copy link
Author

Here we can see the convention of how libuv deal with the indexing of stdio,0 is stdin,1 is stdout,2 is stderr
https://github.com/libuv/libuv/blob/fbe2d85bd5a5c370a8cacea92b3bdfbd9f98a530/src/win/process.c#L1018-L1020

@skypjack skypjack self-requested a review October 17, 2024 16:26
@skypjack skypjack self-assigned this Oct 17, 2024
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.

2 participants